%% Created by Maple V Release 4 (IBM INTEL NT)
%% Source Worksheet: TD8integral.mws
%% Generated: Fri Apr 13 17:32:05 2007
\documentclass{article}
\usepackage{maple2e}
\DefineParaStyle{Maple Output}
\DefineParaStyle{Maple Plot}
\DefineCharStyle{2D Math}
\DefineCharStyle{2D Output}
\begin{document}
\pagestyle{empty}
\begin{maplegroup}
\begin{mapleinput}
\mapleinline{active}{1d}{Rect:=proc(f,N,a,b)
local nbrect,i,S,x,n;
nbrect:=[seq(N*i,i=1..N)]:
S:=seq(student[leftbox](f(x),x=a..b,n),n=nbrect):
plots[display](S,insequence=true);
end:}{%
}
\end{mapleinput}

\end{maplegroup}
\begin{maplegroup}
\begin{mapleinput}
\mapleinline{active}{1d}{Rect(x->x^2,5,0,1);}{%
}
\end{mapleinput}

\mapleresult
\begin{center}
\end{center}

\end{maplegroup}
\begin{maplegroup}
\begin{mapleinput}
\mapleinline{active}{1d}{Rect(x->cos(x),10,0,Pi);}{%
}
\end{mapleinput}

\mapleresult
\begin{center}
\end{center}

\end{maplegroup}
\begin{maplegroup}
\begin{mapleinput}
\mapleinline{active}{1d}{airerect:=proc(f,N,a,b)
local k:
Sum((b-a)/N*f(a+k*(b-a)/N),k=1..N)=evalf(sum((b-a)/N*f(a+k*(b-a)/N),k=1..N));
end:}{%
}
\end{mapleinput}

\end{maplegroup}
\begin{maplegroup}
\begin{mapleinput}
\mapleinline{active}{1d}{airerect(x->x^2,10,0,1);}{%
}
\end{mapleinput}

\mapleresult
\begin{maplelatex}
\[
{\displaystyle \sum _{k=1}^{10}} \,({\displaystyle \frac {1}{1000
}} \,k^{2})=.3850000000
\]
\end{maplelatex}

\end{maplegroup}
\begin{maplegroup}
\begin{mapleinput}
\mapleinline{active}{1d}{airerect(x->cos(x),10,0,Pi);}{%
}
\end{mapleinput}

\mapleresult
\begin{maplelatex}
\[
{\displaystyle \sum _{k=1}^{10}} \,({\displaystyle \frac {1}{10}
} \,\pi \,{\rm cos}({\displaystyle \frac {1}{10}} \,k\,\pi ))=
-.3141592654
\]
\end{maplelatex}

\end{maplegroup}
\begin{maplegroup}
\begin{mapleinput}
\mapleinline{active}{1d}{Trap:=proc(f,N,a,b)
local TV,TR,k,av,ap,T,C;
TV:=NULL: TR:=NULL:
for k from 0 to N do
av:=a+k*(b-a)/N:
ap:=a+(k+1)*(b-a)/N; 
T:=[[av,0],[av,f(av)],[ap,f(ap)],[ap,0]]:
TV:=TV,plot(T,filled=true,color=wheat):
TR:=TR,plot(T,color=black,thickness=2):
od:
C:=plot(f(x),x=a..b,thickness=3):
plots[display](TV,TR,C);
end:}{%
}
\end{mapleinput}

\end{maplegroup}
\begin{maplegroup}
\begin{mapleinput}
\mapleinline{active}{1d}{Trap(x->cos(x),5,0,Pi);}{%
}
\end{mapleinput}

\mapleresult
\begin{center}
\mapleplot{TD8cor03.eps}
\end{center}

\end{maplegroup}
\begin{maplegroup}
\begin{mapleinput}
\mapleinline{active}{1d}{Trapanim:=proc(f,N,a,b)
local nbtrap,i,S,n;
nbtrap:=[seq(N*i,i=1..N)]:
S:=seq(Trap(f,n,a,b),n=nbtrap):
plots[display](S,insequence=true);
end:}{%
}
\end{mapleinput}

\end{maplegroup}
\begin{maplegroup}
\begin{mapleinput}
\mapleinline{active}{1d}{Trapanim(x->cos(x),3,0,2*Pi);}{%
}
\end{mapleinput}

\mapleresult
\begin{center}
\end{center}

\end{maplegroup}
\begin{maplegroup}
\begin{mapleinput}
\mapleinline{active}{1d}{Riem:=proc(f,a,b)
local k;
Limit(Sum(((b-a)/n)*f(a+k*(b-a)/n),k=1..n),n=infinity)=limit(sum(((b-a
)/n)*f(a+k*(b-a)/n),k=1..n),n=infinity);
end:}{%
}
\end{mapleinput}

\end{maplegroup}
\begin{maplegroup}
\begin{mapleinput}
\mapleinline{active}{1d}{Riem(x->x^2,-5,2);}{%
}
\end{mapleinput}

\mapleresult
\begin{maplelatex}
\[
{\displaystyle \lim _{n\rightarrow \infty }} \,{\displaystyle 
\sum _{k=1}^{n}} \, \left(  \! 7\,{\displaystyle \frac {( - 5 + 7
\,{\displaystyle \frac {k}{n}} )^{2}}{n}}  \!  \right) =
{\displaystyle \frac {133}{3}} 
\]
\end{maplelatex}

\end{maplegroup}
\begin{maplegroup}
\begin{mapleinput}
\mapleinline{active}{1d}{int(x^2,x=-5..2);}{%
}
\end{mapleinput}

\begin{mapleinput}
\end{mapleinput}

\mapleresult
\begin{maplelatex}
\[
{\displaystyle \frac {133}{3}} 
\]
\end{maplelatex}

\end{maplegroup}
\begin{maplegroup}
\begin{mapleinput}
\mapleinline{active}{1d}{airetrap:=proc(f,N,a,b)
local k:
(b-a)/N*((f(a)+f(b))/2+Sum(f(a+k*(b-a)/N),k=1..N-1))=evalf((b-a)/N*((f
(a)+f(b))/2+Sum(f(a+k*(b-a)/N),k=1..N-1)));
end:}{%
}
\end{mapleinput}

\end{maplegroup}
\begin{maplegroup}
\begin{mapleinput}
\mapleinline{active}{1d}{evalf(Pi);}{%
}
\end{mapleinput}

\mapleresult
\begin{maplelatex}
\[
3.141592654
\]
\end{maplelatex}

\end{maplegroup}
\begin{maplegroup}
\begin{mapleinput}
\mapleinline{active}{1d}{4*airerect(x->sqrt(1-x^2),10000,0,1);}{%
}
\end{mapleinput}

\mapleresult
\begin{maplelatex}
\[
4\, \left(  \! {\displaystyle \sum _{k=1}^{10000}} \,(
{\displaystyle \frac {1}{100000000}} \,\sqrt{100000000 - k^{2}})
 \!  \right) =3.141391481
\]
\end{maplelatex}

\end{maplegroup}
\begin{maplegroup}
\begin{mapleinput}
\mapleinline{active}{1d}{4*airetrap(x->sqrt(1-x^2),10000,0,1);}{%
}
\end{mapleinput}

\mapleresult
\begin{maplelatex}
\[
{\displaystyle \frac {1}{5000}}  + {\displaystyle \frac {1}{2500}
} \, \left(  \! {\displaystyle \sum _{k=1}^{9999}} \,(
{\displaystyle \frac {1}{10000}} \,\sqrt{100000000 - k^{2}}) \! 
 \right) =3.141591478
\]
\end{maplelatex}

\end{maplegroup}
\begin{maplegroup}
\begin{mapleinput}
\mapleinline{active}{1d}{mini:=proc(u,p) 
local k;k:=0;
while (evalf((u^(2*k+3))/(2*k+3)))>(10^(-p)) do  
k:=k+1;
od:
end:}{%
}
\end{mapleinput}

\end{maplegroup}
\begin{maplegroup}
\begin{mapleinput}
\mapleinline{active}{1d}{greg:=proc(n,a,p)
local S,k; S:=0;  
for k from 0 to n+1/2 do  
 S:=S+evalf(((-1)^k*a^(2*k+1))/(2*k+1),p+1); 
od;
S;
end:
}{%
}
\end{mapleinput}

\end{maplegroup}
\begin{maplegroup}
\begin{mapleinput}
\mapleinline{active}{1d}{mini(1/5,100);}{%
}
\end{mapleinput}

\mapleresult
\begin{maplelatex}
\[
69
\]
\end{maplelatex}

\end{maplegroup}
\begin{maplegroup}
\begin{mapleinput}
\mapleinline{active}{1d}{Digits:=100:
4*(4*greg(69,1/5,100)-greg(69,1/239,100));}{%
}
\end{mapleinput}

\mapleresult
\begin{maplelatex}
\begin{eqnarray*}
\lefteqn{
3.1415926535897932384626433832795028841971693993751058209749445923
\backslash } \\
 & & 07816406286208998628034825342117064\mbox{\hspace{183pt}}
\end{eqnarray*}
\end{maplelatex}

\end{maplegroup}
\begin{maplegroup}
\begin{mapleinput}
\mapleinline{active}{1d}{4*(4*greg(69,1/5,100)-greg(69,1/239,100))-eva
lf(Pi,100);}{%
}
\end{mapleinput}

\mapleresult
\begin{maplelatex}
\[
-.4\,10^{-98}
\]
\end{maplelatex}

\end{maplegroup}
\begin{maplegroup}
\begin{mapleinput}
\end{mapleinput}

\end{maplegroup}
\begin{maplegroup}
\begin{mapleinput}
\end{mapleinput}

\end{maplegroup}
\end{document}
%% End of Maple V Output
