Message Boards Message Boards

0
|
2212 Views
|
1 Reply
|
1 Total Likes
View groups...
Share
Share this post:

Solve an equation inside a loop

Posted 3 years ago

Hello all,

I am trying to solve a polynomial equation in each loop:

For[i = 0,
i < 21,
i++,
y = i; R[i] = Solve[x + x^5*y + y == x, x]
]

I am not sure how to store the solutions in a vector R since there are several solutions. Is it correct?

For simplicity, I am even interested only in the largest real solution

POSTED BY: O L
Posted 3 years ago

Try

R={};
For[i = 0,i < 21,i++,
  AppendTo[R,x/.Solve[x + x^5*i +i == x, x][[1]]]];
R

or perhaps more simply

R=Table[x/.Solve[x + x^5*i +i == x, x,Reals][[1]],{i,0,21}]
POSTED BY: Bill Nelson
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract