0
|
6612 Views
|
3 Replies
|
0 Total Likes
View groups...
Share
GROUPS:

# combining solve and for

Posted 9 years ago
 Hello I am trying to find the solution of an equation for many values in a sequence this is the code that i am using but it doesnt give any result. eq = x^2 - 5; c = Last[Solve[eq == 1, x]] Do[Last[Solve[eq == a, x]], {a, 10}] For[i = 1, i < 11, i++, Solve[eq == a, x]] I have tried to do the loop with the function For and the function Do but still i dont get anywhere, also afterwards i would like to save just the positive solution and plot it. i hope you could help me Thanks and Regards Gregorio
3 Replies
Sort By:
Posted 9 years ago
 never use for loop in Mathematica :) see attachment.. Attachments:
Posted 9 years ago
 Thanks a lot this work perfect!
Posted 9 years ago
 Hello again i did a small step , i got the solutions but now i am getting everything as an object instead as a number, i would like to have the numbers, i have tried using Table instead of print but it doesnt work eq = x^2 - 5; For[i = 1, i < 11, i++, f = Last[Solve[eq == i, x]]; h = Print[{i,N[x /. f]}]] So now i would like to save those values (h) in a table and then plot them Regards