No BSD License  

Highlights from
Alternative Mathematics using MATLAB 7

image thumbnail

Alternative Mathematics using MATLAB 7

by

 

13 Mar 2003 (Updated )

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

ex151.m
% ex151.m:  Integration by Direct Summing 					         
clear all,  format long	
xn=input('xn= (e.g. 1) ');		% Right end coordinate
x1=0;  n=500;				% Number of sub-intervals
h=(xn-x1)/n;  				% Length of sub-interval
X=x1: h: xn-h; 				% Omit the last point
F=cos(X);				
integral=sum(F)* h;			% Sum of function values
int_ex=sin(xn)-sin(x1);			% Exact integral
integrals=[integral  int_ex]		% Display comparison
format short e,  error=integral-int_ex		

Contact us