The following (incomplete) code in Matlab was proposed to use the bisection method in order to compute a root of the equation tan x - x = 0. % The bisection algorithm for finding % a root of the equation tan(x)-x=0. f=inline('tan(x)-x'); a=4.3; b=4.6; iter=0; if f(a)*f(b)>0 error( 'f(a) and f(b) do not have opposite signs' ) else p = (a + b)/2; err = abs(f(p)); while err > 0.01 if f(a)*f(p)<0 .....; else .....; end iter=iter+1; .....; err = abs(f(p)); end end (a) Fill in the lines indicated by the arrows in order to complete the above code. Note: You are NOT allowed to change or remove any other lines of the code. (b) How many iterations are needed for the above accuracy? (c) What is the approximation of the root of tan x - x = 0 computed by the above (completed) code?
Added by Nicole S.
Close
Step 1
First, we need to define the function `f(x)` which is `tan(x) - x`. We can do this by adding the following line at the beginning of the code: ```matlab f = @(x) tan(x) - x; ``` Show more…
Show all steps
Your feedback will help us improve your experience
Keondre Parker and 78 other Calculus 3 educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
Sri K.
Recommended Textbooks
Calculus: Early Transcendentals
Thomas Calculus
Watch the video solution with this free unlock.
EMAIL
PASSWORD