Implement a MATLAB function schroderbisectionm of the form f

Implement a MATLAB function schroderbisection.m of the form function [r, h] = schroderbisection(a, b, f, p, t) a: Beginning of interval [a, b] b: End of interval [a. b] f: function handle [f, fp, fpp] 18 f(x, p) should return f, f\' and f\'\' at x p: parameters to pass through to f t: User-provided tolerance for interval width which combines the fast convergence of the Schroder iteration for multiple g(x) = x - f(x)/f\'(x)1 -1/f(x)f\'\'(x)/f(x) = x- f(x) f\'(x)/f\'(x)^2 - f(x)f\"(x) with the bracketing guarantee of bisection. At each step j = 1 to n, carefully choose in geometric mean bisection (watch out for zeroes!). Define c = min(|f(b) - f(a)|/8, |f\'\'(m)||b - a|^2) Apply the Schroder iteration function g{x) to two equations f_plusminus (x) = f(x)_plusminus e = 0, yielding six candidates g_plusminus = g_plusminus (m), a_plusminus = g_plusminus (a), b_plusminus = g_plusminus (b). Replace [a, b] by the smallest interval with endpoints chosen from a, a_+, a_-, m, q_+, q_-, b_-, b_+, b which keeps the root bracket. pea until a f value exactly vanishes, b-a lessthanorequalto tmax(|a|, |b|), or b and a are adjacent floating point numbers, whichever comes first. Return the final approximation to the root r = (a + b)/2 and a 3 times n history matrix h[1:3, 1:n] with column h[1:3, j] = (a, b, f(m)) recorded at step j. Compare results with problems 8-10. Let lambda_k be n + 1 distinct real numbers. Let t_j be n + 1 distinct real numbers. Show that a(t_j) = integral^n_k=0 a_ke^lambda_k^t can vanish for all real t only if a_0 = a_1 = ...= a_n = 0. Show that for the exponential interpolation problem a(t_j) = integral^n_k=0 a_ke^lambda_k^t_j = f_j 0 lessthanorequalto j lessthanorequalto n there exists a unique solution a(t) for any data values f_j. For equally spaced lambda_k = -k/n, find an explicit formula and an error estimate for a(t). Interpolate Runge\'s function f(t) = 1/1 + t^2 at n + 1 equidistant points on [0, 5] by your formula from (c) and tabulate the error for n = 3, 5, 9, 17, 33.

Solution

function [r,h] =schroderbisection(a,b,f,fp,fpp,t)
h=zeros(3,100);
j=1;
while(abs(b-a)>t)
x=(a:b);
p=(a+b)/2;
d=abs((f(b)-f(a))/8);
m=abs(((b-a)^2)*fpp(p));
if(d>m)
e=m;
else
e=d;
end;

q2=p-(f(p)+e)*fp(p)/((fp(p))^2-(f(p)+e)*fpp(p));
q1=p-(f(p)-e)*fp(p)/((fp(p))^2-(f(p)-e)*fpp(p));

if(a<q1)
a=q1;

end;


if(q2<b)
b=q2;

end;
if f(p)*f(a)>0
a=p;
else
b=p;

end;

h(1,j)=a+h(1,j);

h(2,j)=b+h(2,j);

h(3,j)=f(p)+h(3,j);

j=j+1;

end;

r=(b+a)/2;

end

 Implement a MATLAB function schroderbisection.m of the form function [r, h] = schroderbisection(a, b, f, p, t) a: Beginning of interval [a, b] b: End of interv
 Implement a MATLAB function schroderbisection.m of the form function [r, h] = schroderbisection(a, b, f, p, t) a: Beginning of interval [a, b] b: End of interv

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site