Question: use for loops with while loops and if statements. Must be done in C (code blocks) Problem 2 In this problem you are going to
use for loops with while loops and if statements.
Must be done in C (code blocks)
Problem 2 In this problem you are going to create a C program that calculates the root, x*, of a polynomial function, f(x), using the bisection method. The bisection method is an iterative method, that requires an initial guess for the interval (a, b) around the value ofx*, where we suspect root offx) is located, to calculate the true value ofx* to an accuracy of e. This means, that the bisection method will calculate x* such that Page 1 of 5 SJSU AE 30 L. Capdevila 4/16/2018 General procedure for the bisection method is as follows: 1) Get initial values for a andib 2) Calculate an initial guess for x*, g, where g -(a + b)/2 3) Calculatef(x) at x-g, that is,f(g) 4) If fig)l 2 e, the following will occur: a. Calculate the function value at a, that is, f(a) b. If the SIGN offg) matches the SIGN off(a), update the value of a to the value of g, that is, set a -g. Otherwise, update b to the value of g, that is, set b -g c. Update g, that is, g - (a+b)/2 d. Update the function value at g, that is,fg) 5) Go back to step 4) until |f(g)l
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
