Message Boards Message Boards

Plotting points from Root inside For-loop

Posted 11 years ago
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.
POSTED BY: abhishek sharma
6 Replies

i will see into it..
POSTED BY: abhishek sharma
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:
POSTED BY: Sean Clarke
I mean to say that i want to run programme2 to automatically collect values from the table generated in programme1.
POSTED BY: abhishek sharma
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:
POSTED BY: Sean Clarke
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 BY: Isaac Abraham
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.
POSTED BY: abhishek sharma
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract