I am studying numerical analysis and also solving algorithms which is described in book. My problem is about Newton's method. In general, if some function is given and we have to find root, how can we determine derivative of function in code? or even limit? because as you know Newton's method involves derivative and makes iteration like this.
Suppose some function f(x)
and initial guess,p0,
then p(n)=p(n-1)+f(p(n-1))/f'(p(n-1))
here f'
denotes derivative of f
.
How can I approximate it in code? Thanks a lot.