Académique Documents
Professionnel Documents
Culture Documents
=====
>
1 Sintaxis Bsica:
1.- Zona de Texto
2.- Zona de comandos ( Cada comando debe finalizar con ;
o con : )
3.- Zona de respuestas
> 25! + 13^23;
2 Primeros Pasos
Maple V hace clculos tanto con numeros enteros como en
Punto Flotante
> 15 + 5^20;
> (1+2)*3^2;
> 2^-5;
`-` unexpected
> evalf(pi);
La precisin de su evaluacin puede ser controlada:
> sqrt( 68 ); sqrt( 68. ); evalf(sqrt(68),50 );
> restart;
Para asignar un objeto a una variable se hace con el
operador :=
> f := arctan( (2*x^2-1)/(2*x^2+1) );
> f;
> restart;
3 Clculo Elemental
Se definen, se evalan y se derivan funciones abstractas
> f:= (x,y) -> exp(x^2+y^2)/(x-y);
> f(a^(1/2),b^(1/2));
> f(2,3);
> evalf(%);
> diff( f(x,y) , x) + diff( f(x,y) , y) ;
> diff(f(t,r),t$3);
> D(cos@ln@sqrt)(x);
> diff(cos(ln(sqrt(x))),x);
Lmites:
> f:= (x) -> 1/(1+r/x)^x;
> Limit(f(x),x=infinity) = limit(f(x), x=infinity);
Sumatorias:
> Sum((1+i)/i^2, i = 1..n) ;
> value(%);
> ?gamma
> ?Psi
Integracin:
> g:=(x)-> 1/( x*( b*x+c*x^2)^(1/2) );
> assume(z>0):
> Int(h(t),t=0..infinity): %= value(%);
> infolevel[int]:=5:
> Int(x/(x^2+2*x+2),x): %= value(%);
int/indef1: first-stage indefinite integration
int/ratpoly: rational function integration
> diff(rhs(%),x);# Chequeamos...
> simplify(%);
> restart;
4 Resolucin de sistemas de ecuaciones algebraicas
Resuelve sistemas de ecuaciones algebricas. El resultado
queda almacenado en una lista, y luego hay que asignar
esos valores al "nombre" de las variables correspondientes
para seguir operando.
> ecu1:= R[1]*i[1]+R[3]*i[3]+R[4]*i[4]-V[1]=0;
> sol:=solve(p,x);
> evalf(%);
> restart:
5 Ecuaciones Diferenciales
> ED1:=diff(y(x),x)+y(x)/x=alpha/(x*y(x)^2);
> dsolve(ED1,y(x));
> sols:=dsolve({ED1,y(1)=5},y(x));
> fcns:={y(x),z(x)};
> s:=dsolve({sys,y(0)=0,z(0)=1},fcns,method=laplace);
> simplify(ED2);
> F(0.0);
> with(plots):
> odeplot(F,[t,g(t)],1..10,labels=[t,g]);
> odeplot(F,[t,f(t)],1..10,labels=[t,f]);
> with(DEtools):
>S:=cos(xi)*diff(h(xi),xi$3)-
diff(h(xi),xi$2)+Pi*diff(h(xi),xi)=h(xi)-xi;
>DEplot(S,h(xi),xi=-2.5..1.4,[[h(0)=1,D(h)(0)=2,
(D@@2)(h)(0)=1]],h=-4..5,stepsize=.05);
> restart;
6 Formatos de Salidas
MapleV permite pasar las expresiones a LATEX
> alias(f=f(x,y,z)):# Otra manera de definir funciones
> f:=sin(sqrt(x^2+y^2+z^2)/(y^2+z^2));
> latex(%);
{\frac {\partial }{\partial x}}\sin({\frac {\sqrt {{x}^{2}+{y}^{2}+{z}
^{2}}}{{y}^{2}+{z}^{2}}})=\cos({\frac {\sqrt {{x}^{2}+{y}^{2}+{z}^{2}}
}{{y}^{2}+{z}^{2}}})x{\frac {1}{\sqrt {{x}^{2}+{y}^{2}+{z}^{2}}}}
\left ({y}^{2}+{z}^{2}\right )^{-1}
> latex(%,`c:/usuarios/hector/archi1.txt`);
...o en cdigo FORTRAN (en precisin doble y
optimizado si el caso)
> h:= Pi*f/2 + 3*diff(f,x)+ 5*diff(f,y) + 4*diff(f,z);
> expand(p);
> factor(p);
>t:=cos(x)^5+sin(x)^4+2*cos(x)^2-2*sin(x)^2-
cos(2*x);
> simplify(t);
> r:=alpha*(x^3-y^3)/(beta*(x^2+x-y-y^2));
> normal(r);
> n*d*delta;
> expand(%);
> collect(%,x);
> coeff(%,x^3);
> factor(%);
> expr3:=sin(x)*cos(x);
> expr4:=convert(%,exp);
> op(3,expr2)*op(3,expr4);
> simplify(%);
No siempre todo funciona de la manera correcta. La
siguiente intregal es trivial, pero veamos lo que sucede con
Maple V
> Int(2*x*(x^2+1)^24,x);
> value(%);
> factor(%);
> factor(%+1/25);
> restart;
8 Maple V como lenguaje de programacin
> isprime(37);
> isprime(3778);
> for i to 8 do
> n := 2^(2*i+1)-1;
> if isprime(n)
> then print( n, `Es primo !`);
> else print( n, `No es primo`)
> fi;
> od;
>
> f := proc(x,y);
> 2*x-2*y;
> end;
>
> h := proc(x);
> if x > 5 then x^2 else 5-2*x fi;
> end;
> factor(P);
> realroot(P);
> readlib(realroot):
> realroot(P,1);
> plot3d(g(x,y),x=-1..1,y=-1..1);
>
>plot3d({h(x),j(x)},x=-3..3,y=-3..3,title=`Interseccion de
h(x) y j(x)`);
Mapas Topolgicos
> with(plots):
> contourplot(sin(x*y),x=-10..10,y=-10..10);
Graficando Campos Vectoriales :
> phi[1]:=(x,y)->ln((x^2+2*x+1+y^2)^(1/2));
> phi[2]:=(x,y)->-ln((x^2-2*x+1+y^2)^(1/2));
> fieldplot([phi[1](x,y),phi[2](x,y)],x=-2..2,y=-
2..2,arrows=SLIM,grid=[8,8]);
> gradplot((-phi[1](x,y)-phi[2](x,y)),x=-2..2,y=-
1..1,arrows=SLIM,grid=[10,10]);
Animaciones:
> animate3d(cos(sqrt(t*x^2+t*y^2)),x=-5..5,y=-
5..5,t=1..8);
Con un poco ms de complejidad
>
tubeplot({[10*cos(t),10*sin(t),0,t=0..2*Pi,radius=2+cos(
7*t),numpoints=120,tubepoint=24],
[0,10+5*cos(t),5*sin(t),t=0..2*Pi,radius=1.5,numpoint=
50,tubepoint=18]});
>
11 Procesos en UNIX
Es posible utilizar Maple V en UNIX por medio del
comado: maple
nodo5%> maple
> evalf(sqrt(Pi),100);
1.772453850905516027298167483341145182797549456
122387\
12821380778985291128459132181374950656738544665
>
/
|
| tan(x) dx = - ln(cos(x))
|
/
>
nodo5%>
>
Programa Mint:
Es un programa que permite verificar si un archivo fuente
de Maple V tiene errores de sintxis
12 Aplicaciones
Algebra Lineal
> restart:
> with(linalg):# Leemos el paquete de A.L.
Warning, new definition for norm
Warning, new definition for trace
>
> B:=array(antisymmetric,1..3,1..3):
> B[1,2]:=x+a; B[1,3]:=y+b; B[2,3]:=z+c;
> print(B);
> v:= vector([1,2,3] );
> M:=array(antisymmetric,1..3,1..3):
> entermatrix(M);
enter element 1,2 > 2*alpha;
enter element 1,3 > 2*beta;
enter element 2,3 > 2*gamma:
> N:=diag(mu,nu,lambda);
> G:=diag(M,N);
>
> ec2:=(c-1)*x+(c^2-1)*y=c-1;
> sis:=({ec1,ec2}):
> solve(sis,{x,y});
>
> H:=genmatrix(sis,[x,y],'flag');
> A:=genmatrix(sis,[x,y]);
> B:=delcols(H,1..2);
> S:=evalm(M+N);
> evalm(M*N);
Error, (in evalm/evaluate) use the &* operator for matrix/vector
multiplication
> print(S);
> zeta:=inverse(S);
> trace(zeta);
> det(zeta);
>
> K:=matrix([[sqrt(2),alpha,beta],[alpha,sqrt(2),alpha],
[beta,alpha,sqrt(2)]]);
> factor(%);
> solve(pc=0,lambda);
> eigenvals(K);
> eigenvects(K);
> K1:=map(evalf,K);
> eigenvects(K1);
Error, (in linalg/evalf) matrix entries must all evaluate to float
> eigenvects(K2);
> map(evalf,[%]);
>
Funciones test
> map(simplify,T);
>
Clculo Vectorial.
Gradiente
> f:= 4*x*y*z - 5*y*x^3;
Rotores
> curlv:= curl(v,[x,y,z] );
Jacobianos
> jacobian(%,[x,y,z]);
Laplacianos
> laplacf:= laplacian(f,[x,y,z] );
> ?coords
Lectura de datos de un archivo para una posterior visualizacion
>
Mdat:=matrix(readdata(`c:/usuarios/hector/setdatos`,5
));
> x:=col(Mdat,3);
> numrows:=rowdim(Mdat);
Podemos hacer simples graficos de x vs y
> set1:= [seq( [x[i] , y1[i]] , i=1..numrows)]:
> set2:= [seq( [x[i] , y2[i]] , i=1..numrows)]:
> p1:=plot(set1,0..1,style=point,labels=[x,y],color=red):
>
p2:=plot(set2,0..1,style=point,labels=[x,y],color=green):
> datos:=plots[display]({p1,p2}):
> datos;
>
>
Astronoma
Datos Meteorolgicos
>
Fractales
Nombre Frmula de iteracin Inicializacin de z
Inicializacin de c
Julia zn+1 := zn + c z0 := x + I*y c = a + I*b
http://SunSite.informatik.rwth-
aachen.de/maple/frame03.htm
Julia sets, written by John Oprea.
oprea@math.csuohio.edu
> restart; with(plots):
> julia := proc(c,x, y)
local z, m;
z := evalf(x+y*I);
for m from 0 to 30 while abs(z) < 3 do
z := z^2 + c
od;
m
end:
> J := proc(d)
global phonyvar;
phonyvar := d;
(x, y) -> julia(phonyvar, x, y)
end:
> plot3d(0, -2 .. 2, -1.3 ..1.3, style=patchnogrid,
orientation=[-90,0], grid=[250, 250],
scaling=constrained, color=J(-1.25));
>
>
=========================================
===