Maple
Son bon usage en mathématiques
Philippe Dumas, Xavier Gourdon
Springer-Verlag, 1997
Code Maple du Chapitre 5, Livre second.
# section 1, page 223.
f1:=1/(x^6-1)^3;
F1:=int(f1,x);
f2:=1/(x^3-x-1)^3;
F2:=int(f2,x);
convert(F1,ln);
diff(ln(x-alpha),x),diff(ln(C*(x-alpha)),x),
f3:=1/(x^2-x-1);
F3:=int(f3,x);
convert(F3,ln);
window:=[-5..3,-4..4]:
picture[0]:=plot(GAMMA(x),x=0..3,view=window):
for k to 5 do
picture[k]:=plot(GAMMA(x),x=-k..-k+1,view=window,numpoints=100)
od:
plots[display](seq(picture[k],k=0..5),scaling=constrained);
asympt(ln(GAMMA(x)),x);
# exercice 5.3, page 231.
trace(GAMMA):
# fin exercice 5.3.
# section 3, page 235.
# probleme page 235.
R:=1+2*x-2*x^2+4*x^3-10*x^4+50*x^5+125*x^6:
collect(R^2,x);
count(R,x),count(R^2,x);
# fin probleme.
# probleme page 237.
solveI(x/4-x^2+x^3,x,0..2, 10^(-2));
# fin probleme.
# section 4, page 239.
# probleme page 239.
E1:=Int(exp(-t)/t,t=z..infinity):
J:=student[intparts](E1,1/t);
for k from 2 to 5 do J:=student[intparts](J,1/t^k) od:
J;
g:=exp(x^2)*x/ln(x):
crack(g,x);
g:=1/x:
crack(g,x);
g:=exp(x^2)*x/ln(x):
integrationbyparts(g,x,crack(g,x));
f:=1/ln(x):
DAIntf:=intasympt(f,x,10);
f:=exp(-x^2):
DAIntf:=intasympt(f,x);
asympt(",x);
# fin probleme.
# section 5, page 244.
# exercice 5.2, page 244.
Y[0]:=lnx:
for n to 6 do Y[n]:=asympt(subs(y=Y[n-1],lnx-ln(y)),lnx) od:
subs(lnx=L[1],ln(L[1])=L[2],"):
map(collect,asympt(",L[1]),L[2]);
# fin exercice 5.2.
# exercice 5.4, page 245.
N:=100:
MaxDigits:=N+5:
a:=evalf(Pi,MaxDigits):
epsilon:=10^(-N):
Digits:=2:
x:=evalf(1/a):
while MaxDigitsepsilon do
Digits:=min(2*Digits,MaxDigits):
x:=2*x-a*x^2 od:
x;
a:=2:
x:=0.5:
N:=100:
MaxDigits:=N+5:
Digits:=2:
epsilon:=10^(-N):
while Digitsepsilon do
Digits:=min(2*Digits,MaxDigits):
x:=1.5*x-0.5*a*x^3
od:
x:=2*x;
# fin exercice 5.4.
# exercice 5.5, page 247.
dichotomy:=proc(f,x::name,I::range)
local oldDigits,a,b,c,fa,fb,fc,eps;
oldDigits:=Digits;
Digits:=Digits+3;
a:=evalf(op(1,I));
b:=evalf(op(2,I));
fa:=evalf(subs(x=a,f));
fb:=evalf(subs(x=b,f));
if fa*fb>=0 then ERROR(`input does not satisfy the hypothesis,
f(a)*f(b)<0`)
fi;
eps:=(1+abs(a)+abs(b))*10^(-oldDigits);
while b-a>eps do
c:=0.5*(a+b); #a
fc:=evalf(subs(x=c,f));
if fc=0 then RETURN(evalf(c,oldDigits)) fi;
if fa*fc<0 then b:=c
else a:=c: fa:=fc fi; #z
od;
evalf(0.5*(a+b),oldDigits)
end:
c:=(a*fb-b*fa)/(fb-fa); #a
fc:=evalf(subs(x=c,f));
if fc=0 then RETURN(evalf(c,oldDigits)) fi;
if fa*fc<0 then b:=c; fb:=fc
else a:=c: fa:=fc fi; #z
# fin exercice 5.5.
# exercice 5.6, page 247.
F:=vector([x^2+y^2-1,x^3+y^3-3*x*y]):
invJ:=evalm(linalg[jacobian](F,[x,y])^(-1)):
X:=vector([1.,0.]):
FX:=subs(x=X[1],y=X[2],eval(F)):
while (linalg[norm](FX) > 10^(2-Digits)) do
X:=evalm(X-subs(x=X[1],y=X[2],evalm(invJ&*FX))):
FX:=subs(x=X[1],y=X[2],eval(F)):
od:
eval(X);
# fin exercice 5.6.
# exercice 5.7, page 248.
solve(y=exp(y*ln(x)),y);
# fin exercice 5.7.
# exercice 5.8, page 250.
assume(x>0);
assume(n,posint);
u:=x^n/n!*exp(-x):
asympt(u,n,1);
factor(diff(u,x));
asympt(subs(x=n,u),n,1);
factor(diff(u,n));
asympt(",n,1);
dominant:=subs(n=x,u);
plot([seq(subs(n=nn,u),nn=0..10),dominant],x=0..10,
color=black,thickness=[1$11,3]);
asympt(dominant,x,1);
int(u,x=0..infinity);
u:=sin(Pi*x)/(1+x^n):
plot([seq(subs(n=nn,u),nn=0..10)],x=0..10,color=black,
thickness=[1$9,3]);
w:=n^alpha*x*(1-x^2)^n:
diff(w,x):
xi:=[solve(",x)];
subs(x=xi[1],w);
asympt(remove(has,",alpha),n,3);
factor(diff(w,n));
select(has,",ln);
nu:=solve(",n);
dominant:=subs(n=nu,w);
series(dominant,x=1,2);
convert(dominant,exp);
simplify(",ln);
subs(ln(-(x-1)*(x+1))=series(ln(-(x-1)*(x+1)),x),");
assume(n,posint):
int(w,x=0..1);
# fin exercice 5.8.