from system of scalar differential equations to matrix differential equationpag.525, #11. DO 12The system is x"+3x'+2y=0
y"-2x=0.Let z1=x, z2=x', z3=y, z4=y'. Then then the new equations arez1' = z2z2' = -3z2 -2z3z3' = z4z4' = 2z1 The resulting matrix equation is with(LinearAlgebra):
Z:=Matrix(<z1(t),z2(t),z3(t),z4(t)>):
map(diff,Z,t)=Matrix(<<0,0,0,2>|<1,-3,0,0>|<0,-2,0,0>|<0,0,1,0>>).Z;matrix algebra, pag. 539matrix product. DO 8Note that matrix multiplication is noncommutative (order of factors is important) and is indicated by a special symbol .restart:
A:=Matrix(<<1,1>|<2,1>>);
B:=Matrix(<<0,1>|<3,2>>);A.B;B.A;#13. matrix inverse. DO 14Computing the multiplicative inverse of a matrix A in Maple is easy: we just write 1/A.)restart:
A:=Matrix(<<-2,2,3>|<-1,1,1>|<1,0,-1>>);
B:=1/A;We can check that B is the inverse. Note that the product in either order is the identity matrix.A.B;
B.A;Singular matrix. No solutions, many solutions. DO 16One way to show that a matrix A is singular (has no inverse) is to try to invert it. Another approach is to show that the determinant is zero.restart:
with(linalg):
A:=Matrix(<<-2,3,2>|<1,-6,2>|<-1,-3,4>>);
1/A;Notice that MAPLE gives error! Indeed, the matrix is not invertible as its determinant vanishes:det(A);b) To show that the equation has no solutions, we can augment the right hand side and use Gaussian elimination to do the row operations.B:=Matrix(<-3,-3,6>);
Matrix(<<A|B>>);
gausselim(%);Since there are all zeros in the first three columns, across from a -3 in the fourth column, there can be no solutions. (Regardless of the values chosen for the variables, if they are multiplied by zeros, the result could never equal -3.) If there were a solution, the left three columns would form an identity matrix and the solution would be the fourth column.c) B:=Matrix(<-3,0,6>);
Matrix(<<A|B>>);gausselim(%);
backsub(%);The LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYkLUklbXN1YkdGJDYlLUkjbWlHRiQ2JVEjX3RGJy8lJ2l0YWxpY0dRJXRydWVGJy8lLG1hdGh2YXJpYW50R1EnaXRhbGljRictRiM2JC1JI21uR0YkNiRRIjFGJy9GNlEnbm9ybWFsRidGPi8lL3N1YnNjcmlwdHNoaWZ0R1EiMEYnRj4= entry can be chosen arbitrarily, and the other two entries are computed from it. Since multiple choices exit for LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYkLUklbXN1YkdGJDYlLUkjbWlHRiQ2JVEjX3RGJy8lJ2l0YWxpY0dRJXRydWVGJy8lLG1hdGh2YXJpYW50R1EnaXRhbGljRictRiM2JC1JI21uR0YkNiRRIjFGJy9GNlEnbm9ybWFsRidGPi8lL3N1YnNjcmlwdHNoaWZ0R1EiMEYnRj4= , the equation has multiple solutions.#19. inverse of a matrix with expression entries. DO 20restart:
A:=Matrix(<<exp(t),exp(t),exp(t)>|<exp(-t),-exp(-t),exp(-t)>|<exp(2*t),2*exp(2*t),4*exp(2*t)>>);The reciprocal command produces the inverse matrix. Since we would prefer another form for the answer, we follow the reciprocal operation with a map command. The map command applies the same function to each element in a matrix. Here we use the command map(simplify, ), which forces the output to use exponentials with negative exponents, rather than fractions.1/A;
map(simplify,%);#25. determinant of a square matrix. DO 26restart:
with(linalg):
A:=Matrix(<<1,-1,4>|<4,-1,5>|<3,2,2>>);det(%);#28. characteristic equation: eigenvalues. DO 29We label the identity matrix Id (since I already has a meaning as a complex number). restart:
with(linalg):
Id:=Matrix(<<1,0>|<0,1>>);The equation det(A-r*Id)=0 is called the characteristic equation of A.A:=Matrix(<<3,2>|<3,4>>);
char_poly:=det(A-r*Id);The roots of the characteristic equation are called eigenvalues.solve(char_poly,r);One can directly use the "eigenvals" command:eigenvals(A);#33. derivative of a matrix. DO 34The derivative of a matrix is formed by taking the derivative of each entry using the map command. The map command applies an operation to each piece of an object that has more than one piece, such as equations, lists, or matrices. Since the derivative command has to know what variable to take the derivative with respect to, the last part of the command ",x" is included to provide this information.
restart:
X:=Matrix(<<exp(5*t),-2*exp(5*t)>|<3*exp(2*t),-exp(5*t)>>);DX:=map(diff,X,t);#37. verifying that a matrix solves a differential equation. DO 38We verify that a matrix satisfies a differential equation by substituting and seeing if both sides are equal.restart:
A:=Matrix(<<1,2>|<-1,4>>);
X:=Matrix(<<exp(2*t),-exp(2*t)>|<exp(3*t),-2*exp(3*t)>>);map(diff,X,t)-A.X;#39(a). integrating a matrix. DO 40(a)To integrate a matrix, we integrate each element using the map command. Since Maple does not add a constant of integration, we must add our own.restart:
A:=Matrix(<<t,1>|<exp(t),exp(t)>>);map(int,A,t)+Matrix(<<c11,c21>|<c12,c22>>);
Notice that in general, the constants are different, one for each entry.p. 548#1. system to matrix. DO 3We can produce the matrix equation by entering the coefficients of A and f by hand.restart:
A:=Matrix(<<3,-1>|<-1,2>>);
f:=Matrix(<t^2,exp(t)>);
z:=Matrix(<x(t),y(t)>);
We compute z'=az+f.map(diff,z,t)=A.z+f;#12. matrix to system. DO 11The matrix equation is converted to three scalar equations. Note that we subtract the rhs from the lhs in order to make equations which are equal to 0.restart:
A:=Matrix(<<0,0,-1>|<1,0,1>|<0,1,2>>);
f:=Matrix(<1,-1,2>);
g:=Matrix(<3,1,0>);
X:=Matrix(<x1(t),x2(t),x3(t)>);EQ:=map(diff,X,t)-A.X -t*f-g: Maple has as a default that if it expects an equation and there is only an expression, then it will form an equation by setting the expression to 0. We can use that fact as follows:eqns:={EQ[1,1]=0,EQ[2,1]=0,EQ[3,1]=0};We could also have donewith(student):
eqns:=equate(map(diff,X,t),A.X+t*f+g);#22. fundamental solution sets. DO 21restart:
with(linalg):
x1:=Matrix(<exp(t),exp(t),exp(t)>);
x2:=Matrix(<sin(t),cos(t),-sin(t)>);
x3:=Matrix(<-cos(t),sin(t),cos(t)>);F:=Matrix(<x1|x2|x3>);
det(F);
simplify(%);Since the Wronskian is not zero, the vector valued solutions form a fundamental solution set.#23. superposition. DO 24a) We verify that the vector expressions are solutions by subtracting the right hand side from the left in the equation, substituting, and looking for 0. restart:
x1:=Matrix(<exp(t),exp(t)>);
x2:=Matrix(<exp(-t),3*exp(-t)>);
A:=Matrix(<<2,3>|<-1,-2>>);To verify that the functions solve the homogeneous equation:map(diff,x1,t)-A.x1;map(diff,x2,t)-A.x2;Similarly, we check the particular solution:f:=Matrix(<exp(t),t>);xp:=(3/2)*Matrix(<t*exp(t),t*exp(t)>)-(1/4)*Matrix(<exp(t),3*exp(t)>)+Matrix(<t,2*t>)-Matrix(<0,1>);
map(diff,xp,t)-A.xp-f;To form the general solution to the nonhomogeneous equation x'=Ax+f, we superimpose the particular solution on the general homogeneous solution.sol:=c1*x1+c2*x2+xp;
Checking:map(diff,sol,t)-A.sol -f;TTdSMApJNlJUQUJMRV9TQVZFLzEzNTQ2NTQ0MFgsJSlhbnl0aGluZ0c2IjYiW2dsISIlISEhIyMiIyIiLSUkZXhwRzYjJSJ0R0YnRiY=TTdSMApJNlJUQUJMRV9TQVZFLzEzNTc1MDU2OFgsJSlhbnl0aGluZ0c2IjYiW2dsISIlISEhIyMiIyIiLSUkZXhwRzYjLCQlInRHISIiLCRGJyIiJEYmTTdSMApJNlJUQUJMRV9TQVZFLzEzNTc1ODk2MFgsJSlhbnl0aGluZ0c2IjYiW2dsISIlISEhIyUiIyIjIiIjIiIkISIiISIjRiY=TTdSMApJNlJUQUJMRV9TQVZFLzEzNjA3MTA1NlgsJSlhbnl0aGluZ0c2IjYiW2dsISIlISEhIyMiIyIiIiIhRidGJg==TTdSMApJNlJUQUJMRV9TQVZFLzEzNjEyNDM1NlgsJSlhbnl0aGluZ0c2IjYiW2dsISIlISEhIyMiIyIiIiIhRidGJg==TTdSMApJNlJUQUJMRV9TQVZFLzEzNjEzNTg0MFgsJSlhbnl0aGluZ0c2IjYiW2dsISIlISEhIyMiIyIiLSUkZXhwRzYjJSJ0R0YqRiY=TTdSMApJNlJUQUJMRV9TQVZFLzEzNjMzNDA4MFgsJSlhbnl0aGluZ0c2IjYiW2dsISIlISEhIyMiIyIiLCgqJiUidEciIiItJSRleHBHNiNGK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