quiz حل الأسئلة الجامعية manage_search الأرشيف

تم الحل ✓
categoryرياضيات schoolبكالوريوس event_available2026-07-14

السؤال

Transcribed Image Text:

1. Implement the bisection method (textbook §2.1). Your function should have the following signature, function r = bisection (f, a, b, tol, maxits) where f is a function handle and a, b, tol, maxits, and r are numbers. Your implementation can assume that -Inf <a<b<Inf, sign(f(a)) sign (f(b)) f is continuous on [a, b]. ⚫tol is nonnegative, and maxits is a positive integer. Your implementation should estimate the absolute error as one-half the width of the current search interval, and terminate once this estimate no longer exceeds tol. Additionally, your implementation should perform at most maxits iterations, and should report a warning to the user if your error estimate still exceeds tol after maxits iterations. (This matches the functionality in the textbook's implementation, Algorithm 2.1.) (a) Test your code by using it to approximate the root of r sin(z). (Pick a and b to 'bracket' this root.) Find values of tol and maxits so that the six leading digits of r are correct (3.14159). (b) Use your code to try to find a root of a tan(r) on the interval [1,2]. Explain what happens. To find a solution to f(x) = 0 given the continuous function f on the interval [a, b], where f(a) and (b) have opposite signs: INPUT endpoints a, b; tolerance TOL; maximum number of iterations No. OUTPUT approximate solution p or message of failure. Step 1 Set i = 1; FA = f(a). Step 2 While i No do Steps 3-6. Step 3 Set p=a+ (b-a)/2; (Compute pi.) FP= f(p). Step 4 If FP 0 or (b-a)/2 < TOL then OUTPUT (p); (Procedure completed successfully.) STOP. Step 5 Set i=i+1. Step 6 If FA FP> 0 then set a p; (Compute a, b.) = FA= FP else set b = p. (FA is unchanged.) Step 7 OUTPUT ("Method failed after No iterations, No =', No); (The procedure was unsuccessful.) STOP.

check_circle الجواب — حل مفصل خطوة بخطوة

hourglass_top