Question: MATLAB: I need part B. To do: I basically need to find the roots to Newton's Cubic (x^3-2x-5=0) and I need the Newton.m code (including
A. Newton-Raphson root-finder Write a code Newton.m that implements the Newton-Raphson method for finding a root of Fx) It requires F(x) to be differentiable with computable derivative DF(x) The user should provide: xo: initial guess, maxIT: max number of iterations, and TOL: tolerance for convergence For convenience, you may set TOL- 1.e-14 in the code so only x0, maxIT need to be provided as arguments Newton converges fast typically, so maxIT 20 usually suffices The code should: accept input x0, maxIT print out the iterates n xn Fn (neatly, in columns, use format: %d %f %e and, upon convergence, print out the value of the root, the residual (%e format), and how many iterations it took B. To do: l. Debug the code on a simple problem with known solution, e.g. Fo x2-2 2. Use your Newton code to find all three roots of the cubic: Fox) 3x 3 Try various x0, like: 2, 1,0.5, 0.1, 0.0, -0.5, -1, etc Do you notice anything unexpected/interesting? what? 3. Also try some big x0: 100, 1000, -100, etc Do you notice anything unexpected interesting? what? 4. Answer the questions: a. What are the three roots you found How many iterations did each one take? With what x0 b. Is Newton more efficient than Bisection? how did you decide? c. What is the effect of changing the initial guess x0 d. What is the effect of changing maxIT e. What is the effect of changing the tolerance 5. Now find the roots of "Newton's cubic 2x -5 (the only equation Newton ever bothered to solve with his method, in 1671 C. Prepare Lab15.tat for submission: In a plain text file, insert your Name, Date, Lab15 Answers to the questions in B.4 (each labeled and separated by What are the roots of"Newton's cubic" in how many iterations? with what x0 Insert your Newton m code (including FCN)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
