Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

x Bisection Method 3 solutions submitted (max: 10) View my solutions Problem Summary Implement the bisection method as a function: function [p, n] = bisect(f,

image text in transcribed
image text in transcribed
image text in transcribed
x Bisection Method 3 solutions submitted (max: 10) View my solutions Problem Summary Implement the bisection method as a function: function [p, n] = bisect(f, a,b, tol) We seek a root of the anonymous function f in the interval [a, b]. The function should return an approximation p that is within a user input tol of the actual root as well as the number of iterations n it took to converge. As a class convention, we will take p to be the midpoint of the first interval smaller than tol. As a class convention, we will count the first bisection as the midpoint of the supplied interval [a, b]. You do not need to worry about the exceptional case when a bisection lands exactly on a root. (You can if you want to, but you may assume this does not occur.) My Solutions Solution 3: 5 of 9 Test Results tests passed Submitted about 19 hours ago ID: 57808364 Size: 103 i function (p.n] = bisect if a, b, tol) 2 Sinput f. anonymous function for which 3 inputs a,b left and right ends for wt 4 Sinput tot a tolerance, algorithm stop 5 Soutput P. the approximate root, we s 6 Routput n, the number of bisections to 7 p = (a+b)/2; 8 9 if f(a) f(p)> 10 11 a = p; 12 13 else 14 15 b = p; 16 17 end 18 19 pprev = p; 20 21 p = (a+b)/2; 22 23 n = 3; 24 25 while abs (pprev-p)stol 26 27 if f(a)f(p)>0 28 29 OP: 30 31 else 32 33 bsp; 34 35 end 36 37 Pprev = p; 38 39 P(a+b)/2: 40 41 n = n+1; 42 43 end 44 45 end > Test a certain root finding problem: the root (Pretest) > Test a certain root finding problem: the root (Pretest) Variable y has an incorrect value. > Test a certain root finding problem: the number of iterations (Pretest) * Test a different root finding problem: the root Variable y has an incorrect value. Test a different root finding problem: the number of iterations Test a different root finding problem: the root Variable y has an incorrect value. Test a different root finding problem: the number of iterations Test a different root finding problem: the root Variable y has an incorrect value. Test a different root finding problem: the number of iterations

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

AWS Certified Database Study Guide Specialty DBS-C01 Exam

Authors: Matheus Arrais, Rene Martinez Bravet, Leonardo Ciccone, Angie Nobre Cocharero, Erika Kurauchi, Hugo Rozestraten

1st Edition

1119778956, 978-1119778950

More Books

Students also viewed these Databases questions