No BSD License  

Highlights from
Alternative Mathematics using MATLAB 7

image thumbnail

Alternative Mathematics using MATLAB 7



13 Mar 2003 (Updated )

Self-instructive text on undergraduate algebra, statistics, differential and integral calculus.

% ex102.m:  Find Zeros by Bisection				                 
clear all,  format long
f=inline('x^3- 2*x^2- x+2');								% Define function f(x)
figure(1),  fplot(f, [-2 3]),  grid on,  zoom on	% Plot survey
x1=-1.4;  x2=-0.2;				% Initial values, x2>x1
while 1==1							% Repeat forever   
   f1=f(x1);  f2=f(x2);
   x0=(x1+x2)/2;  f0=f(x0);     
   x1_x0_x2=[x1 x0 x2]			% Equidistant coordinates
   f1_f0_f2=[f1 f0 f2]				% Display function values
   if f0*f1>0,  x1=x0;  else x2=x0;  end 			% Replace one value
   error=abs(x2-x1)						% Safe error estimate
   if error<1e-15,  break,  end		% Stop the loop
   pause										% Push <Return> to continue
end											% Endpoint of loop
x0                   							% Display final value

Contact us