I have the following problem. My alpha must be between {0,1}. The function is
f[x_] = Log[x] + x - 0.5;
y[x_] = x - alpha*f[x]/f'[x];
0.75 + 4 (y[0.75] - 0.75) f[0.75]/(3 f[0.75] - 2 f[y[0.75]])
I should make a loop with all the values between 0 and 1 until the end result no longer change - it must happen automatic. I have tried with while, do and fixed point, but I did not get any result. I should get for Alpha = 0.5046 and for end result 0.766249. Thanks in advance
Please make sure you know how to format code properly: https://wolfr.am/READ-1ST
I have tried with while, do and fixed point, but I did not get the right result.
Please edit your post and add code you have tried as you mention above.
vaungureanu
(Valeriu Ungureanu)
November 8, 2016, 10:47am
3
You may try this:
f[x_] := Log[x] + x - 0.5
y[x_] := x - \[Alpha] f[x]/f'[x]
Table[FixedPointList[# + (4 (y[#] - #) f[#])/(3 f[#] - 2 f[y[#]]) &, 0.75],{\[Alpha], 0, 1, 0.01}]
That is what i need. Thank you a lot. Can you tell me how to display the current value of alpha and the relevant result.
vaungureanu
(Valeriu Ungureanu)
November 8, 2016, 12:51pm
5
Sure, you can apply FixedPoint[] as well as FixedPointList[]:
f[x_] := Log[x] + x - 0.5
y[x_] := x - \[Alpha] f[x]/f'[x]
Table[Print["\[Alpha] = ", \[Alpha], " ",
FixedPoint[# + (4 (y[#] - #) f[#])/(3 f[#] - 2 f[y[#]]) &,
0.75]], {\[Alpha], 0, 1, 0.01}]
Thank you very much! You save me. Have a nice day