Question: Project In the Calculus we study the Newton - Raphson method for solving equations. This technique uses the value of a function and its derivative
Project In the Calculus we study the NewtonRaphson method for solving equations. This technique uses the value of a function and its derivative to estimate where the function crosses the axis. If necessary it repeats the process until the amount of change in the estimate is smaller than some predetermined amount.
The formula is
You will write a program that uses a recursive function to perform this operation estimating where a function crosses the x axis.
Methodology
Prompt the user for the mathematical function that you want to solve.
Prompt the user for the starting value. Call this
Call the getzero function. You will pass the function and the starting value for the zero of the function. The function will return a new value for the zero.
In the getzero function you will set a stopping criteria. Call this eps. It should be a small value, say eps This is done first, before the calculations or the selection.
Then calculate a value for by evaluating the function and an estimate of the derivative at Use the derivative function that you wrote for project
Compare to eps. This would be ifabs
If eps then call getzerof from the selection structure. You pass the same function and the same variable, but the current contains the new predicted value for the intercept.
If If eps the function returns the calculated intercept value.
Call printresults to show the function, the starting value, and the estimated zero. An example of what the output might look like is
tableFunctionStart,Zero
Call the plot function to see the results graphically
You may create any function to integrate that you would like. I suggest that you start with simple curves to allow you to check that your results are accurate. Just be sure to choose a function that does cross the axis. As an example, try The correct result will be Remember that every program that you submit must include an introduction consisting of your name, the date, and a description of the program as both comments at the beginning of
the program and as text that is printed when you call printheader function. The program must implement topdown design in that you should be using functions through out your code.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
