Question: needs to be written in C# (12%) Newtons method (roots). Newtons method or Newton-Raphson method of calculating a function / a polynomials roots is an
needs to be written in C#
(12%) Newtons method (roots). Newtons method or Newton-Raphson method of calculating a function / a polynomials roots is an easy way that uses only the knowledge of ECE 114 (for loop). Write a method Newtonsmethod that calculates (or attempt to calculate) a root from an initial guess.
You need to stop the for loop or while loop when x n and xn+1 are close (for example, if their difference is less than 1.0x10-7. ) or when n is big, say bigger than 50, since you do not want to iterate forever. However, there is a validity check: you want to make sure f(x n) 0; it would make no sense if f(x n) = 100 and you call that a root.
Test your method with the polynomial x3 + x + 1 and the initial guess x = -1.; and also the polynomial x2 - 3x + 2 and the initial guess x = 0. We do not try to calculate complex roots here.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
