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.

% ex142.m:  Sum of a Geometric Series				                 
clear all,  format long			% Clear variables and functions
k=input('k= (e.g. 0.5) ');		% Enter k from keyboard
si=0;  i=0;					% Initial values for sum and index
while 1==1					% Set up loop 
   i=i+1;					% Next index
   term=k^(i-1);  si=si+term;		% Add a term to sum (si)		
   index(i)=i;				% Index=vector of indices
   sumv(i)=si;				% Sumv=vector of sums
   if abs(term)<1e-15, break,  end
end						% End of loop
figure(1),  plot(index, sumv),  grid on,  xlabel('index'),  ylabel('sumv')
   title('Geometric Series')
sum_ex=1/(1-k);				% Analytic limit
sums=[sumv(i) sum_ex]		% Last sum compared

Contact us