Objective: Write a program to calculate the root of a function using Newton’s Me
ID: 3629346 • Letter: O
Question
Objective: Write a
program to calculate the root of a function using Newton’s Method.
General Comments: Make sure the program follows the programming
practices discussed in class. The copy of program turned in must be compiled
using Silverfrost. Use subroutines to calculate the values of the functions
used in the root finding method. Format screen outputs for neatness and
clarity.
Program Description & Requirements:
The program needs to calculate the value of x needed to satisfy y=g(x)
using Newton’s Method where y is specified by the user. The function g(x) is
predefined and showed below.
y=g(x)=0.093x^3 0.2x^2 +10x 30
Specifically the program must do the following:
i) Write the equation g(x) to the screen and inform the user
this is the function being solved.
ii) Request from the user the value of y for which x will be
solved for. User will input the value from the screen.
iii) Request from the user an initial guess of x. User will
input the value from the screen.
iv) Calculate the value of x needed to achieve y within a
tolerance of y±0.0001 using Newton’s Method.
v) To produce a code that can be easily modified to solve for
other equations, the functions f(x,y) and f’(x,y) needs to be contained within
a subroutine (see the below Note for definition of these functions).
vi) Write the value of x to the screen.
vii) Write the number of iterations required to reach the
solution to the screen