Search code examples
plotwolfram-mathematica

Mathematica Plotting Solve Results


Remove["Global`*"]
a = 0;
For[z = 0, z < 3, z++, Sol[a] = x /. Solve[z^2 + x == 10, x]; 
 a = a + 1;]

I am new to the mathematica so I'm experimenting with it.Answer of the problem changes at every loop so I stored them inside an array. I can see the numeric results using Do[Print[Sol[a]], {a, 0, 2}]; but how can I plot the results I tried using Plot[Sol[[a]], {a, 0, 2}] but it didn't work.


Solution

  • Remove["Global`*"]
    func = z^2 + x == 10;
    sol = Solve[func, x];
    Plot[x /. sol, {z, 0, 3}]
    

    enter image description here