This is my code so far:
For[i=2, i<10, i++, Solve[x^i == x+1 && x >0]]
I would like to sum up all the x values that it outputs. How can I do so?
Mathematica Stack Exchange is a question and answer site for users of Wolfram Mathematica. It only takes a minute to sign up.
Sign up to join this communityThis is my code so far:
For[i=2, i<10, i++, Solve[x^i == x+1 && x >0]]
I would like to sum up all the x values that it outputs. How can I do so?
Quick answer
Total@Table[ x /. Solve[x^i == x + 1 && x > 0][[1]] , {i, 2, 9}]//N
(*9.76035*)
Sum[x /. Solve[x^i == x + 1 && x > 0][[1]], {i, 2, 9}] // N
$\endgroup$
– WReach
Dec 24 '19 at 6:38
Total@Table[x /. First@NSolve[x^i == x + 1 && x > 0], {i, 2, 9}]
$\endgroup$ – MarcoB Dec 23 '19 at 21:20