Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Implement Newton's Method to find roots of 3rd order polynomials given an initial guess (http: //mathworld.wolfram.com/NewtonsMethod.html) Key programming concepts: while loops, if statements, conditions, and,
Implement Newton's Method to find roots of 3rd order polynomials given an initial guess (http: //mathworld.wolfram.com/NewtonsMethod.html) Key programming concepts: while loops, if statements, conditions, and, or Approrimate lines of code: 23 (does not include comments, white space Prohibited code/commands/functions: Any automatic root finders, return, root, poly Program Inputs Enter x^3 coeff: Enter x~2 coeff: Enter r 1 coeff: Enter ax 0 coeff: User will always enter numeric values for each coefficient Enter initial guess: User will always enter a numeric value Program Outputs Improper polynomial; no possible roots. Display this message if given polynomial doesn't have any roots Solution not found in 5000 iterations. Display this message if Newton's Method takes over 5000 iterations (typically happens when roots are imaginary) Found root of XXX in YYY iterations, Replace XXX with the found root to 3 decimal places and YYY with the number of algorithm iterations Assignment Details Newton's Method is a common numerical analysis method to approximate roots of polynomials. Remember that a polynomial is a mathematical expression of variables raised to powers and multiplied by coefficients, for example f(x) = x2 + 7x + 10 It is often necessary to find the roots of a polynomial, which are the values of the independent variable (x) that evaluate the polynomial to zero, eg. (r) = 0 For example, the first polynomial f(x)7x+10 has two roots at -2 and-5. We can solve for these values programmatically by iteratively solving Newton's equation. The method starts with an initial guess (xold) and uses the given polynomial and its derivative to to find a new guess (Tneu) Told f derivative (Told This is best illustrated with an example. The polynomial f(x)2 3r +2 has the derivative Jderivative()2+3, and we can find one of its roots by starting from an initial guess of 0 The update formula is used every loop iteration until a root is found or too many tries have been made. A root is reached when lnew stops changing based on the following equation: Tnew-Told 10 Enen Here is a complete example: f(x)03 +2 +3r +2 and fderivative(x)23 absolute(n-a
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started