






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!







First, we briefly review basic Maple commands and how we can use Maple to study differential equations. Most of this should be familiar from the previous tutorial as well as your first Maple assignment.
A few things to remember and. what you need to do first when things don’t work out!
How to print? You can print by clicking on the printer button above (or go to File and select Print ) Choose "Print Command" option and then type lpr −l −P printername That "−l" is dash−lower−case−L. Then hit "Print" button on the bottom of the print window Printer names are lcb115 in room LCB 115 spps in South Physics 205 mc155c in the Math Center
Arithmetic operation
**> restart;
> 3+4; 67; (3+4)^2/5;* 7 42 49 5
> evalf((3+4)^2/5);
**> evalf3;
**> a := 3.5;
a := 3.
**> a;
Differentiation and Integration
**> diff(x^3,x); # differentiate x^3 with respect to x > diff(x^3,x,x); # take second derivative
3 x^2 6 x
> f:= x −> exp(sin(x))x^3; # defining a function*
sin ( ) x x^3
> diff(f(x),x);
cos ( ) x e
sin ( ) x x^3 + 3 e
sin ( ) x x^2
**> int(t^2,t);
t^3 3
> int(t^2,t=0..1); # computing definite integral 1 3
*> int(t^3exp(sin(t)),t);
t^3 e
sin ( ) t dt
*> evalf(int(t^3exp(sin(t)),t=0..1));
> evalf(Pi); evalf(exp(1)); infinity; # some important numbers
**> evalf(int(exp(−x),x=0..infinity));
Plotting > with(plots): # load plot library Warning, the name changecoords has been redefined
*> dsolve(diff(y(t),t)=3y(t)+t, y(t));
y ( ) t = − t 3
( 3 t ) _C
*> dsolve(diff(y(t),t)=3y+t, y(t));
Error, (in ODEtools/info) y(t) and y cannot both appear in the given ODE.
**> dsolve({eqn1, y(0)=1}, y(t));
y ( ) t = − t 3
e
( 3 t )
**> DEplot(eqn1, y(t), t=0..10, y=0..100, title="slope fields");
**> DEplot(eqn1, y(t), t=0..10, y=0..100,{[y(0)=0],[y(0)=2]});
You can change how things look by using the different option. Run the following few commands.
**> DEplot(eqn1, y(t), t=0..10, y=0..100,{[y(0)=0],[y(0)=2]}, color = blue );
**> DEplot(eqn1, y(t), t=0..10, y=0..100,{[y(0)=0],[y(0)=2]}, linecolor = blue );
**> DEplot(eqn1, y(t), t=0..10, y=0..100,{[y(0)=0],[y(0)=2]}, arrows = line );
**> DEplot(eqn1, y(t), t=0..10, y=0..100,{[y(0)=0],[y(0)=2]}, arrows = thick );
**> DEplot(eqn1, y(t), t=0..10, y=0..100,{[y(0)=0],[y(0)=2]}, dirgrid = [20,20] );
> DEplot(eqn1, y(t), t=0..10, y=0..100,{[y(0)=0],[y(0)=2]}, dirgrid = [10,10] );
> restart;
> with(linalg): Warning, the protected names norm and trace have been redefined and unprotected
Defining matrices and vectors
> A.B; # matrix multiply using ’.’ not ’’* 7 36 4 16 81 10
25 126 16
> AB;* Error, (in rtable/Product) invalid arguments
> A.v; # matrix and vector multiplication 18 42
66
**> A^2; # you can take the square of a matrix so that
30 36 42 66 81 96
102 126 150
> AA;* 30 36 42 66 81 96
102 126 150
> (A^4); # you can raise the matrix to any power you want 7560 9288 11016 17118 21033 24948
26676 32778 38880
In your text, they use the command Array instead of Matrix. This will work but doing operations is a bit tricky.
> C := Array([ [1,2,3],[4,5,6],[7,8,9] ]);
*# you can use the operation ’’ or ’.’
1 4 9 16 25 36
49 64 81
> C.C; 1 4 9 16 25 36
49 64 81
Computing determinant and inverse
**> B_inv := Matrix(inverse(B));
B_inv :=
− 2
− 8
**> inverse(B).v;
2 0 − 2
− 2
− 8
> Matrix(inverse(B)).v;
Row Operations You need to know three function calls:
> M := Matrix([ [2,2,−1,−6],[3,−3,5,36],[5,4,2,13] ]);
The function mulrow will multiply a row by a constant mulrow(A,2,4) will multiply row 2 of matrix A by 4 Another example below > M1 := mulrow(M, 1 , 1/2); # multiply row 1 of matrix M by 1/
−
The function addrow will multiply a row and then add it to another row addrow(A,1,3,5) will multiply row 1 of matrix A by 5 and then add it to row 3 So addrow(matrix_name, row_a, row_b, coeff) means coeffrow_a + row_b > M2 := addrow(M1,1,2,−3); # −3row(1) + row(2)
−
> M3 := addrow(M2,1,3,−5); # −5row(1) + row(3)*
−
Finally, swaprow will just swap two rows swaprow(A,1,3)
will swap row 1 and row 3 of matrix A > M4 := swaprow(M3,2,3); # swap row 2 and 3
−
Eigenvalues and Eigenvectors You may need these later....
> e := eigenvals(A); # compute the eigenvalues of matrix A
e := 0 , 15 2
Note that one of the eigenvalue is zero which again shows that matrix A is singular (not invertible)
> evalf(eigenvals(A)); # numerical values 0., 16.11684397, −1.
> v := [eigenvectors(A)]; # eigenvectors
v := 15 2
> v[1][1]; # the first eigenvalue 15 2
> v[1][2]; # the multiplicity of that eigenvalue 1
> v[1][3]; # the corresponding eigenvector
**> v[2][1]; v[2][3];