You have a cube Root iteration:
Xi1 = 1/3(2Xi0 + n/(Xi0^2)), where i = 1,2,3,4,5
I want to use For, While or Do command...
How do I solve this?
Do[Print[1/3 (2 i + 8/(i^2))], {i, 1, 3}]
For[i = 1, i < 4, i++, Print[1/3 (2 i + 8/(i^2))]]
You know. how about Do Command instead?
Is there anyone else like here
KubikRod[x_Real?Positive] := Module[{i, a, n}, n = x; a = 1/3 (2 i + (x/2)/i^2); While[a != i, i = a; a = 1/3 (2 i + (x/2)/i^2)]; a ]
I would try NestList, which is designed precisely for iterations:
NestList
step[Xi_] := 1/3 (2 Xi + n/(Xi^2)); NestList[step, 1, 3] NestList[step, 1, 3] /. n -> 8.
Yea I know, but I want to use command: Do, For or While.