# Plotting points from Root inside For-loop

Posted 10 years ago
5958 Views
|
6 Replies
|
3 Total Likes
|
 For[x = 0.1, x < 10, x = x + 0.1, A = x^3 + 3; B = 3 x; Equation = z^2 + A*z + B; V1 = Re[Root[Equation, 1]]; Print[{x, V1}] ]I wish to plot graph between x and V1.
6 Replies
Sort By:
Posted 10 years ago
 Thanks..i will see into it..
Posted 10 years ago
 I'm not sure I understand the question fully.Are you looking to save data you produced to use it at a latter time? If so you can use Export and Import to work with the data. If you are new to using Mathematica, you may want to look through the virtual book which provides a good introduction on how to use Mathematica:http://reference.wolfram.com/mathematica/howto/UseTheVirtualBook.html
Posted 10 years ago
 I mean to say that i want to run programme2 to automatically collect values from the table generated in programme1.
Posted 10 years ago
 This problem can be solved easily by using Table. Please see the documentation on Table for examples of how to use it.pointList = Table[  A = x^3 + 3;  B = 3 x;  Equation = z^2 + A*z + B;  V1 = Re[Root[Equation, 1]];  {x, V1}, {x, 0.1, 10, 0.1}]You can then use ListPlot on the result:ListPlot[pointList]
Posted 10 years ago
 My apologies that i can't get the code blocks to work on my browser. My additions to your code is:  plotPairs = {}; For[ x = 0.1, x < 10....., V1 = Re[Root[Equation,1]];  AppendTo[plotPairs, {x,V1}(* End For *)];  ListPlot[ plotPairs ]
Posted 10 years ago
 Thanks for your kind suggesions..I have one more query..Supose I have 2 Mathemetica programs named as Programme1 And Programme2 In Programme1 we constructed the above said table.Now we wish to use this table in Programme2.How it can be done.