Hello guys. I have a homework and cannot solve this. Please help me and send the codes.
In this homework, you will write a C program that will find A ROOT of an equation of the form
F(x)=Ax3+Bx2+Cx+D=0,
using the modified version of bisection method explained as below, given an interval of x, and an epsilon value :
1. Calculates the F(x) for the endpoint of the interval (F(xlow) and F(xhigh), as in the example graph below).
2. If |F(xlow) | then output xlow
as the root,
else if |F(xhigh) | then output xhigh
as the root,
else if the signs of F(xhigh) and F(xlow) are the same, output “No roots in that interval”
else find the middle of the interval as xmid=(xhigh+xlow)/2. Then, calculate F(xmid). If |F(xmid)| then output xmid
as
the root and stop, otherwise if |F(xmid)| > , assign xmid to xlow
or xhigh such that the signs of F(xlow) and F(xhigh)
will be different (i.e. xmid
will be one of the new ends of this new half interval for the next iteration, [xmid,xhigh]
or [xlow,xmid]), and goto step 1.
Your program, firstly, inputs the coefficients of the equation. Then, repeatedly:
-asks an interval of x (xlow
and xhigh), and an epsilon value to find out a root of the equation in
this interval as explained above.
-If the user inputs 0.0 and 0.0 as the interval, then the program stops.
Initial interval
next interval
ot: This is a simplified version of bisection method of finding the roots of an equation. You may refer to chapter 7 of the text book (Hanly Koffman’s) to check the explanation of the
neral form of this method. But do not use that solution as it uses function that we have not covered yet.