Calculate the root of $x+cos(x)=0$ with Newton-Raphson method.
Could anyone help me on how to apply Newton-Raphson on this equation that includes trigonomtric functions?
Calculate the root of $x+cos(x)=0$ with Newton-Raphson method.
Could anyone help me on how to apply Newton-Raphson on this equation that includes trigonomtric functions?
Copyright © 2021 JogjaFile Inc.
The function you want the root of is $$f(x)=x+\cos x$$ The derivative of that function is $$f'(x)=1-\sin x$$ Since Newton's method uses the iteration $x_{n+1}=x_n-\frac{f(x_n)}{f'(x_n)}$, we substitute the expressions for function and derivative: $$x_{n+1}=x_n-\frac{x_n+\cos x_n}{1-\sin x_n}$$ With that done we need a starting value $x_0$ where $f(x_0)$ is close to zero; here we can take $x_0=-0.5$ (this value being found by looking at the graph). Iterate: $$x_1=-0.7552224171\dots$$ $$x_2=-0.7391416661\dots$$ $$x_3=-0.7390851339\dots$$ $$x_4=-0.7390851332\dots$$ $$x_5=-0.7390851332\dots$$ Our value of x is now not changing (at least within our working precision), so we can stop and conclude that the root of $x+\cos x$ is $-0.7390851332\dots$