Question: C programming seashell For this question, you must implement a bisection function in a bisection module that uses the bisection method to find the root

C programming seashell

C programming seashell For this question, you must implement a bisection functionin a bisection module that uses the "bisection method" to find theroot of an arbitrary function f (the root of a function fis the value x such that f (x) is zero) The function

For this question, you must implement a bisection function in a bisection module that uses the "bisection method" to find the root of an arbitrary function f (the root of a function f is the value x such that f (x) is zero) The function f is passed a double and returns a double The bisection function is passed a lo and hi value such that f (lo) and f(hi) are both non-zero and have opposite signs. As a result, (assuming f is continuous) a root must exist strictly between lo and hi (in fact there must be an odd number of roots, but for this question you only need to consider cases where there is exactly one root in the given range) The bisection function is passed a positive tolerance to determine when the found root is "close enough" The "bisection method" iterates as follows: 1. The midpoint (nid) is found between lo and hi. If If (mid) | is less than or equal to tolerance, the solution has been reached and mid is returned. 3. 2. Otherwise, the sign of f (mid) is observed, and either lo or hi is changed to the value of mid so that the root is still contained within the range. (That is, so that lo and hi have different signs) For this question, the marmoset basic tests ("public" tests) do not test your module at all and simply determine if your code can be "run" A simple test file has been provided to illustrate how bisection can be used For this question, you must implement a bisection function in a bisection module that uses the "bisection method" to find the root of an arbitrary function f (the root of a function f is the value x such that f (x) is zero) The function f is passed a double and returns a double The bisection function is passed a lo and hi value such that f (lo) and f(hi) are both non-zero and have opposite signs. As a result, (assuming f is continuous) a root must exist strictly between lo and hi (in fact there must be an odd number of roots, but for this question you only need to consider cases where there is exactly one root in the given range) The bisection function is passed a positive tolerance to determine when the found root is "close enough" The "bisection method" iterates as follows: 1. The midpoint (nid) is found between lo and hi. If If (mid) | is less than or equal to tolerance, the solution has been reached and mid is returned. 3. 2. Otherwise, the sign of f (mid) is observed, and either lo or hi is changed to the value of mid so that the root is still contained within the range. (That is, so that lo and hi have different signs) For this question, the marmoset basic tests ("public" tests) do not test your module at all and simply determine if your code can be "run" A simple test file has been provided to illustrate how bisection can be used

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!