In order to find roots for f(x) = x*x*x - x*x- 9.0*x + 8.9 in theinterval -1.0 <
ID: 3608969 • Letter: I
Question
In order to find roots for f(x) = x*x*x - x*x- 9.0*x + 8.9 in theinterval-1.0 <= x <= 5.0, create a table for x and f(x) fromx=-1.0 to x=5.0 with
an increment of del_x=0.25. Mark the intervals with 'Y' where f(x)changes
sign. In the table, use %8.2f and %12.4f for printing values of xand
f(x).
In each interval where f(x) changes sign, use the mid-point valueof x as
an initial guess x0 for the Newton-Raphson method, obtain refinedroots
and print each root with %-12.6e. Use double Newton_Raphson(doublex0)
that gives a refined root for an initial guess of x0. (You are notallowed
to modify double Newton_Raphson().)
You need to write the following functions:
double func1(double x) for f(x) = x*x*x - x*x-9.0*x + 8.9;
double func1_d(double x) for f'(x) = 3.0*x*x - 2.0*x - 9.0;
.......................................................................
Your output should look like this:
x f(x) sign change
-----------------------------------------
-1.00 15.9000
-0.75 14.6656
-0.50 13.0250
-0.25 11.0719
0.00 8.9000
0.25 6.6031
0.50 4.2750
0.75 2.0094
1.00 -0.1000 Y
f(0.875) = 9.292969e-01
f(0.984935) = 2.096803e-02
f(0.987537) = 1.324866e-05
f(0.987539) = 5.316636e-12
A refined root is 9.875386e-01
1.25 -1.9594
1.50 -3.4750
1.75 -4.5531
.... .......
Explanation / Answer
In order to find roots for f(x) = x*x*x - x*x- 9.0*x + 8.9 in theinterval -1.0Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.