use mullers method in matlab to solve fxsqrt60035x with h be
use mullers method in matlab to solve f(x)=sqrt(600/(3+.5*x)) with h being .1 and with an error of .01%
Solution
clc;
clear all;
close all;
eps_step = 1e-5;
eps_abs = 1e-5;
x = [0 -0.1 -0.2];
y = [sqrt(600/(3+.5*x(1))) sqrt(600/(3+.5*x(2))) sqrt(600/(3+.5*x(3)))] ;
while ( true )
V = vander( x - x(2) );
c = V / y;
disc = sqrt( c(2)^2 - 4*c(1)*c(3) );
if abs( c(2) + disc ) > abs( c(2) - disc )
denom = c(2) + disc;
else
denom = c(2) - disc;
end
x = [x(2), x(3), x(2) - 2*c(3)/denom]\';
y = [y(2), y(3), sqrt((600/(3+.5*x(3))))]\';
if ( abs( x(2) - x(3) ) < eps_step && abs( y(3) ) < eps_abs )
break;
end
end
------- note mullers method only finds out real solutions---which in our case does not exist
