What is the code for this in Matlab or Mathematica using Newton's method?
Find the root of the following equation x-.08-.02sin(x)=0
Find the root of the following equation x-.08-.02sin(x)=0
Melvyn
Newtons Method boils down to
x_new = x_old - f(x_old)/ f ' (x_old)
where the function f(x)=0
f(x) = x-0.08 -.02 sin x
f ' (x) = 1-0.02 cos x
Now we just need an initial guess ..I suggest x=0
since we are repeating (iterating) the above calculation it suggests a "while" function being used until a certain criteria is met ie perhaps abs[x_new - x_old] <= 0.0001 ?
of course if you want to show off , you could include a check that f '(x_old) didnt equal 0 too
easier reply would be
f[x_]:=x-.08-.02Sin[x];
FixedPoint[#-f[#]/f'[#]&,0]