<Text-field style="Heading 1" size="14" layout="Heading 1"><Font size="14">from system of scalar differential equations to matrix differential equation</Font></Text-field>
<Text-field style="_pstyle1" layout="_pstyle1"><Font style="_cstyle1">pag.525, #11.</Font> <Font style="_cstyle1">DO 12</Font></Text-field> The system is x"+3x'+2y=0 y"-2x=0. Let z1=x, z2=x', z3=y, z4=y'. Then then the new equations are z1' = z2 z2' = -3z2 -2z3 z3' = z4 z4' = 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; Ly1JJ01hdHJpeEc2JCUqcHJvdGVjdGVkR0koX3N5c2xpYkc2IjYjL0kkJWlkR0YoIio3JT5wOC1GJDYjL0YrIio7J1FwOA==
<Text-field style="_cstyle7" layout="_pstyle3"><Font size="12">matrix algebra, pag. 539</Font></Text-field>
<Text-field style="_cstyle7" layout="_pstyle3">matrix product. DO 8</Text-field> Note 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>>); LUknTWF0cml4RzYkJSpwcm90ZWN0ZWRHSShfc3lzbGliRzYiNiMvSSQlaWRHRiciKmtMVU4i LUknTWF0cml4RzYkJSpwcm90ZWN0ZWRHSShfc3lzbGliRzYiNiMvSSQlaWRHRiciKld6c04i A.B; LUknTWF0cml4RzYkJSpwcm90ZWN0ZWRHSShfc3lzbGliRzYiNiMvSSQlaWRHRiciKit2IWY4 B.A; LUknTWF0cml4RzYkJSpwcm90ZWN0ZWRHSShfc3lzbGliRzYiNiMvSSQlaWRHRiciKiFbSmY4
<Text-field style="_cstyle7" layout="_pstyle3">#13. matrix inverse. DO 14</Text-field> Computing 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; LUknTWF0cml4RzYkJSpwcm90ZWN0ZWRHSShfc3lzbGliRzYiNiMvSSQlaWRHRiciKiVRQ2E4 LUknTWF0cml4RzYkJSpwcm90ZWN0ZWRHSShfc3lzbGliRzYiNiMvSSQlaWRHRiciKilbZmY4 We can check that B is the inverse. Note that the product in either order is the identity matrix. A.B; B.A; LUknTWF0cml4RzYkJSpwcm90ZWN0ZWRHSShfc3lzbGliRzYiNiMvSSQlaWRHRiciKkNtK08i LUknTWF0cml4RzYkJSpwcm90ZWN0ZWRHSShfc3lzbGliRzYiNiMvSSQlaWRHRiciKjd5LU8i
<Text-field style="_cstyle7" layout="_pstyle3">Singular matrix. No solutions, many solutions. DO 16</Text-field> One 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; LUknTWF0cml4RzYkJSpwcm90ZWN0ZWRHSShfc3lzbGliRzYiNiMvSSQlaWRHRiciKlcmKSplOA== Error, (in rtable/Power) singular matrix Notice that MAPLE gives error! Indeed, the matrix is not invertible as its determinant vanishes: det(A); IiIh 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(%); LUknTWF0cml4RzYkJSpwcm90ZWN0ZWRHSShfc3lzbGliRzYiNiMvSSQlaWRHRiciKms5X08i LUknTWF0cml4RzYkJSpwcm90ZWN0ZWRHSShfc3lzbGliRzYiNiMvSSQlaWRHRiciKlt4X08i PTYiNiQ7IiIiIiIkO0YmIiIlRVxbbC02JCIiI0YmIiIhNiRGJkYpISIkNiRGJ0YmRi02JEYnRidGLTYkRiZGJiEiIzYkRixGKUYnNiRGLEYsRic2JEYsRidGJzYkRiZGLEYmNiRGJ0YpRi82JEYnRixGLTYkRiZGJyEiIg== 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>>); LUknTWF0cml4RzYkJSpwcm90ZWN0ZWRHSShfc3lzbGliRzYiNiMvSSQlaWRHRiciKkMwZE8i LUknTWF0cml4RzYkJSpwcm90ZWN0ZWRHSShfc3lzbGliRzYiNiMvSSQlaWRHRiciKitHZU8i gausselim(%); PTYiNiQ7IiIiIiIkO0YmIiIlRVxbbC02JCIiI0YmIiIhNiRGJkYpISIkNiRGJ0YmRi02JEYnRidGLTYkRiZGJiEiIzYkRixGKUYnNiRGLEYsRic2JEYsRidGJzYkRiZGLEYmNiRGJ0YpRi02JEYnRixGLTYkRiZGJyEiIg== backsub(%); PTYiNiM7IiIiIiIkRVxbbCRGJiwmIiIjRiYmSSNfdEdGIzYjRiYhIiJGKiwmRiZGJkYrRi5GJ0Yr 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.
<Text-field style="_cstyle7" layout="_pstyle3">#19. inverse of a matrix with expression entries. DO 20</Text-field> restart: 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)>>); LUknTWF0cml4RzYkJSpwcm90ZWN0ZWRHSShfc3lzbGliRzYiNiMvSSQlaWRHRiciKktjWU4i 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,%); LUknTWF0cml4RzYkJSpwcm90ZWN0ZWRHSShfc3lzbGliRzYiNiMvSSQlaWRHRiciKkN0KGY4 LUknTWF0cml4RzYkJSpwcm90ZWN0ZWRHSShfc3lzbGliRzYiNiMvSSQlaWRHRiciKks5K08i
<Text-field style="_cstyle7" layout="_pstyle3">#25. determinant of a square matrix. DO 26</Text-field> restart: with(linalg): A:=Matrix(<<1,-1,4>|<4,-1,5>|<3,2,2>>); LUknTWF0cml4RzYkJSpwcm90ZWN0ZWRHSShfc3lzbGliRzYiNiMvSSQlaWRHRiciKjsnKSplOA== det(%); IiNE
<Text-field style="_cstyle7" layout="_pstyle3">#28. characteristic equation: eigenvalues. DO 29</Text-field> We label the identity matrix Id (since I already has a meaning as a complex number). restart: with(linalg): Id:=Matrix(<<1,0>|<0,1>>); LUknTWF0cml4RzYkJSpwcm90ZWN0ZWRHSShfc3lzbGliRzYiNiMvSSQlaWRHRiciKmt0KmU4 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); LUknTWF0cml4RzYkJSpwcm90ZWN0ZWRHSShfc3lzbGliRzYiNiMvSSQlaWRHRiciKkMvZk4i LCgiIiciIiJJInJHNiIhIigqJEYlIiIjRiQ= The roots of the characteristic equation are called eigenvalues. solve(char_poly,r); NiQiIiciIiI= One can directly use the "eigenvals" command: eigenvals(A); NiQiIiciIiI=
<Text-field style="_cstyle7" layout="_pstyle3">#33. derivative of a matrix. DO 34</Text-field> The 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)>>); LUknTWF0cml4RzYkJSpwcm90ZWN0ZWRHSShfc3lzbGliRzYiNiMvSSQlaWRHRiciKiFRc2E4 DX:=map(diff,X,t); LUknTWF0cml4RzYkJSpwcm90ZWN0ZWRHSShfc3lzbGliRzYiNiMvSSQlaWRHRiciKks8dk4i
<Text-field style="_cstyle7" layout="_pstyle3">#37. verifying that a matrix solves a differential equation. DO 38</Text-field> We 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)>>); LUknTWF0cml4RzYkJSpwcm90ZWN0ZWRHSShfc3lzbGliRzYiNiMvSSQlaWRHRiciKk9WVU4i LUknTWF0cml4RzYkJSpwcm90ZWN0ZWRHSShfc3lzbGliRzYiNiMvSSQlaWRHRiciKkNCdk4i map(diff,X,t)-A.X; LUknTWF0cml4RzYkJSpwcm90ZWN0ZWRHSShfc3lzbGliRzYiNiMvSSQlaWRHRiciKmddMU8i
<Text-field style="_cstyle7" layout="_pstyle3">#39(a). integrating a matrix. DO 40(a)</Text-field> 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)>>); LUknTWF0cml4RzYkJSpwcm90ZWN0ZWRHSShfc3lzbGliRzYiNiMvSSQlaWRHRiciKi9OWU4i map(int,A,t)+Matrix(<<c11,c21>|<c12,c22>>); Notice that in general, the constants are different, one for each entry. LUknTWF0cml4RzYkJSpwcm90ZWN0ZWRHSShfc3lzbGliRzYiNiMvSSQlaWRHRiciKkdmQ08i
<Text-field style="_cstyle7" layout="_pstyle3">p. 548</Text-field>
<Text-field style="_cstyle7" layout="_pstyle3">#1. system to matrix. DO 3</Text-field> We 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)>); LUknTWF0cml4RzYkJSpwcm90ZWN0ZWRHSShfc3lzbGliRzYiNiMvSSQlaWRHRiciKk9WVU4i LUknTWF0cml4RzYkJSpwcm90ZWN0ZWRHSShfc3lzbGliRzYiNiMvSSQlaWRHRiciKmsiXGQ4 LUknTWF0cml4RzYkJSpwcm90ZWN0ZWRHSShfc3lzbGliRzYiNiMvSSQlaWRHRiciKmsjZWQ4 We compute z'=az+f. map(diff,z,t)=A.z+f; Ly1JJ01hdHJpeEc2JCUqcHJvdGVjdGVkR0koX3N5c2xpYkc2IjYjL0kkJWlkR0YoIipPJ2ZkOC1GJDYjL0YrIipHLy5PIg==
<Text-field style="_cstyle7" layout="_pstyle3">#12. matrix to system. DO 11</Text-field> The 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)>); LUknTWF0cml4RzYkJSpwcm90ZWN0ZWRHSShfc3lzbGliRzYiNiMvSSQlaWRHRiciKiVRQ2E4 LUknTWF0cml4RzYkJSpwcm90ZWN0ZWRHSShfc3lzbGliRzYiNiMvSSQlaWRHRiciKm8pSGQ4 LUknTWF0cml4RzYkJSpwcm90ZWN0ZWRHSShfc3lzbGliRzYiNiMvSSQlaWRHRiciKikpZXROIg== LUknTWF0cml4RzYkJSpwcm90ZWN0ZWRHSShfc3lzbGliRzYiNiMvSSQlaWRHRiciKk8pW2Q4 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}; PCUvLCotSSVkaWZmRyUqcHJvdGVjdGVkRzYkLUkjeDFHNiI2I0kidEdGK0YtIiIiLUkjeDJHRitGLCEiIkYtRjEhIiRGLiIiIS8sKi1GJjYkRi9GLUYuLUkjeDNHRitGLEYxRi1GLkYxRi5GMy8sLC1GJjYkRjhGLUYuRilGLkYvRjFGOCEiI0YtRj5GMw== We could also have done with(student): eqns:=equate(map(diff,X,t),A.X+t*f+g); PCUvLUklZGlmZkclKnByb3RlY3RlZEc2JC1JI3gxRzYiNiNJInRHRipGLCwoLUkjeDJHRipGKyIiIkYsRjAiIiRGMC8tRiU2JEYuRiwsKC1JI3gzR0YqRitGMEYsISIiRjBGMC8tRiU2JEY2RiwsKkYoRjhGLkYwRjYiIiNGLEY9
<Text-field style="_cstyle7" layout="_pstyle3">#22. fundamental solution sets. DO 21</Text-field> restart: 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)>); LUknTWF0cml4RzYkJSpwcm90ZWN0ZWRHSShfc3lzbGliRzYiNiMvSSQlaWRHRiciKlchR2Y4 LUknTWF0cml4RzYkJSpwcm90ZWN0ZWRHSShfc3lzbGliRzYiNiMvSSQlaWRHRiciKiEpXEhPIg== LUknTWF0cml4RzYkJSpwcm90ZWN0ZWRHSShfc3lzbGliRzYiNiMvSSQlaWRHRiciKidcL2o4 F:=Matrix(<x1|x2|x3>); det(F); simplify(%); LUknTWF0cml4RzYkJSpwcm90ZWN0ZWRHSShfc3lzbGliRzYiNiMvSSQlaWRHRiciKiNIOWo4 LCQqJi1JJGV4cEc2JCUqcHJvdGVjdGVkR0koX3N5c2xpYkc2IjYjSSJ0R0YpIiIiLCYqJC1JJGNvc0dGJkYqIiIjRiwqJC1JJHNpbkdGJkYqRjFGLEYsRjE= LCQtSSRleHBHNiQlKnByb3RlY3RlZEdJKF9zeXNsaWJHNiI2I0kidEdGKCIiIw== Since the Wronskian is not zero, the vector valued solutions form a fundamental solution set.
<Text-field style="_cstyle7" layout="_pstyle3">#23. superposition. DO 24</Text-field> a) 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>>); LUknTWF0cml4RzYkJSpwcm90ZWN0ZWRHSShfc3lzbGliRzYiNiMvSSQlaWRHRiciKlNhWU4i LUknTWF0cml4RzYkJSpwcm90ZWN0ZWRHSShfc3lzbGliRzYiNiMvSSQlaWRHRiciKm8wdk4i LUknTWF0cml4RzYkJSpwcm90ZWN0ZWRHSShfc3lzbGliRzYiNiMvSSQlaWRHRiciKmcqZWQ4 To verify that the functions solve the homogeneous equation: map(diff,x1,t)-A.x1; LUknTWF0cml4RzYkJSpwcm90ZWN0ZWRHSShfc3lzbGliRzYiNiMvSSQlaWRHRiciKmM1Mk8i map(diff,x2,t)-A.x2; LUknTWF0cml4RzYkJSpwcm90ZWN0ZWRHSShfc3lzbGliRzYiNiMvSSQlaWRHRiciKmNWN08i Similarly, we check the particular solution: f:=Matrix(<exp(t),t>); LUknTWF0cml4RzYkJSpwcm90ZWN0ZWRHSShfc3lzbGliRzYiNiMvSSQlaWRHRiciKlNlOE8i 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>); LUknTWF0cml4RzYkJSpwcm90ZWN0ZWRHSShfc3lzbGliRzYiNiMvSSQlaWRHRiciKiEzTWo4 map(diff,xp,t)-A.xp-f; LUknTWF0cml4RzYkJSpwcm90ZWN0ZWRHSShfc3lzbGliRzYiNiMvSSQlaWRHRiciKmtlVU8i 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*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