Question: 2. Complete the following questions related to Bracket methods: (a) Write a function to perform the Bisection method for any scalar nonlinear equation f(x)

2. Complete the following questions related to Bracket methods: (a) Write a function to perform the Bisection

2. Complete the following questions related to Bracket methods: (a) Write a function to perform the Bisection method for any scalar nonlinear equation f(x) = 0. The inputs to your function should be: a function that calculates the nonlinear equation, the endpoints of the bracketing region, a convergence tolerance and a maximum number of iterations. The function should output the approximate root and the number of iterations. Your function should include an error check to make sure that the bracketing region is valid (a root exists). As an error measure, use both a which is related to the length of the bracketing region and ef which is related to the value of f(r). Both are defined in the problem above. Thoroughly comment your code to show you know what you are doing. (b) Write a function to perform the False Position method for any scalar nonlinear equation f(x) = 0. The instructions for this function are the same as for the Bisection method (see above). (e) Use both of your developed functions in (a) and (b) to complete the following problem: The upward velocity of a rocket can be computed by mo mo-qt, v = u In gt where v upward velocity, u = the velocity at which fuel is expelled relative to the rocket, mo = the initial mass of the rocket at time t = 0, q = the fuel consumption rate, and the downward gravitational acceleration g = 9.81 [m/s]. If u = 1800 [m/s], mo = 160000 [kg], and q = 2600 [kg/s], compute the time at which v= 750 [m/s]. Note: t is somewhere between 10 and 50 [s]. Use a convergence tolerance of 1 x 10-5. In addition, calculate the value of f(x) at the root to show that it is indeed a root of the problem.

Step by Step Solution

3.29 Rating (149 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

a Heres a Python function to perform the Bisection method def bisectionf a b tol1e5 maxiter100 Perform the Bisection method to find the root of fx 0 i... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!