Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C PROGRAM NOT C++ Make sure your program reports out the following: - The polynomial that the user has entered - The initial guess that
C PROGRAM NOT C++
Make sure your program reports out the following:
- The polynomial that the user has entered
- The initial guess that the user has entered
- Whether or not the Newton-Raphson algorithm converged to a solution
- If successful, the root of the polynomial that the algorithm found
- The number of iterations that the Newton-Raphson algorithm required to converge to a solution
Also, add any numerical protections to the algorithm that you find necessary HINT: Divide by zero protection?
2.1 Newton-Raphson Algorithm: Write a program that prompts the user to input the coeflicients co, ci,..., cs of a 5th-order polynomial and an initial value r that serves as a the starting condition for the Newton-Raphson algorithm. The 5th-order polynomial has the form We know that the first derivative of y with respect to r is dar We can use this information to find the roots of the polynomial. The basic idea, in the Newton-Raphson method, is as follows: (a) Given an initial guess I, and polynomial coeflicients c, calculate y (b) Check to see if y is close enough to zero, ie. within some small tolerance close to zero. (i) If so then terminate. Algorithm has converged! (ii) If not, then continue (c) Use the current value of a to calculate y' (d) Create a new guess for r using the update formula r -r- (e) Increment a counter to count the number of algorithm iterations Check to see if the number of iterations has exceeded a predetermined count limit (say 500 (i) If so then terminate. Algorithm has failed! (ii) Ir not, then return to step aStep 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