Question: Please write in Python Finding a zero numerically 5 points Using Newton's method as discussed in the lecture, find the value of x for which
Please write in Python
Finding a zero numerically 5 points Using Newton's method as discussed in the lecture, find the value of x for which f()0. Your answer should be real; increase the tolerance to verify if any imaginary components go to zero. For reference, this is the code we developed. You may also import and use scipy.optimize.nevton if you prefer. A version of this question will be asked on exam. def f, x,h=1e-3 ): dfdx( return (f( x+h ) - fx))/h def newton( f,xe,tol 1e-3): while d tol: d-abs - f xe) return (xe,f xe Finding a zero numerically 5 points Using Newton's method as discussed in the lecture, find the value of x for which f()0. Your answer should be real; increase the tolerance to verify if any imaginary components go to zero. For reference, this is the code we developed. You may also import and use scipy.optimize.nevton if you prefer. A version of this question will be asked on exam. def f, x,h=1e-3 ): dfdx( return (f( x+h ) - fx))/h def newton( f,xe,tol 1e-3): while d tol: d-abs - f xe) return (xe,f xe
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
