Boyce - DiPrima 7.9, Nonhomogeneous Linear Systems Section 7.9, pp. 49--440:, 7, 11, 15 (vop) Additional problems: 1 (diagonalization) Initialization In[77]:= In[78]:= Import"ColorNames.m" DiffEqs` Example 7.9.1, Nonhomogeneous Linear System: Diagonalize the system Find the general solution of the following system. In[79]:= Cleara, x, x1, x, g, t, eqn, Λ, Λ1, Λ, Ξ, Ξ1, Ξ, Η, c1, c; a 1 1 ; gt_ t t ; eqn : x't a.xt gt; Compute the eigensystem for this matrix. In[74]:= Out[74]= Λ Λ1, Λ Eigenvaluesa, 1 There are two real and distinct eigenvalues. In[744]:= Out[744]= Ξ Ξ1, Ξ Eigenvectorsa 1, 1, 1, 1 Assemble two solutions of the homogeneous linear system.
7.9 nonhomogeneous linear systems web.nb In[745]:= x1t_ Ξ1 Λ1 t xt_ Ξ Λ t Out[745]= t, t Out[746]= t, t Verify that x1[t] and x[t] are solutions of the homogeneous equation. In[747]:= Clearx; homogeneouseqn : x't a.xt; xt_ x1t; homogeneouseqn xt_ xt; Out[750]= Out[75]= homogeneouseqn Simplify Verify that these two solutions are linearly independent. In[75]:= Out[75]= wronskian Detx1t, xt 4 t Assemble a general solution of the homogeneous equation. In[754]:= xt_ c1 x1t c xt; Out[755]= homogeneouseqn Simplify In[756]:= Now, we seek to diagonalize the system. T TransposeΞ; DiagonalMatrixΛ; Out[757]//MatrixForm= 1 1 1 1 Out[759]//MatrixForm= 0 0 1 Use the change of variables x = T.y.
7.9 nonhomogeneous linear systems web.nb In[760]:= Cleary, y1, y; yt_ y1t, yt; xt T.yt; eqny y't.yt InverseT.gt Flatten; Out[764]= sys ThreadeqnY y1 t t t y1t, y t t t yt Solve the resulting unlinked system of equations for y1[t] and y[t]. In[765]:= Out[765]= soln DSolvesys, y1t, yt, t Flatten Apart y1t t 1 6 1 t t C1, yt 1 t t t C Capture that result. In[766]:= Out[766]= y1t, yt y1t, yt. soln t 1 6 1 t t C1, 1 t t t C In[767]:= Out[768]//MatrixForm= Construct the solution to the original equation. xt_ T.yt; t 1 6 1 t 1 t t C1 t t C t 1 t 1 6 1 t t C1 t t C Rewrite x[t] as the sum of a particular solution plus the general solution to the homogeneous equation. In[769]:= xt 1 1 1 t 1 4 5 1 t 1 1 t t C1 1 1 t C 1 1 t ; Check this by comparing components. In[770]:= xt 1 1 1 t 1 4 5 1 t Out[770]= 1 1 t t C1 1 1 t C 1 1 t Flatten Simplify Check that x[t] satisfies the original equation. In[771]:= eqn : x't a.xt gt Flatten; Out[77]= eqn Simplify
4 7.9 nonhomogeneous linear systems web.nb Example 7.9., Nonhomogeneous Linear System: Undetermined coefficients Find the general solution of the following system. In[77]:= Cleara, x, x1, x, g, t, eqn, Λ, Λ1, Λ, Ξ, Ξ1, Ξ, Η, c1, c; a 1 1 ; gt_ t t ; eqn : x't a.xt gt; Rewrite g[t]. In[777]:= Out[777]= gt 0 t 0 t Posit a solution of the following form, since -1 is an eigenvalue of the matrix A. In[778]:= Cleara, b, c, d, k; xt_ a t t b t c t d; Substitute x[t] into the original equation. In[780]:= a t a t t b t c A.a t t b t c t d gt; Equate the coefficients of the linearly independent functions to 0. In[781]:= A 1 1 ; A.a a; A.b a b 0 ; A.c 0 ; A.d c; From the first equation, a is an eigenvector of A belonging to eigenvalue - 1. In[786]:= a Α 1 1 ; From the second equation,...
7.9 nonhomogeneous linear systems web.nb 5 In[787]:= b b1 b ; A.b Α 1 1 b 0 ; eqn A. b1 b Α 1 b1 1 b Flatten; 0 eqns b1 b b1 Α, b1 b b Α; Solveeqns, b1, b, Α Flatten Out[791]= Solve::ivar : 1 is not a valid variable. Solve b1 b 1 b1, b1 b 1 b, b1, b, 1 Hence,... In[79]:= Α 1; a 1 1 ; b 1 b b ; Solve the remaining two equations. In[795]:= A.c 0 ; Out[796]= soln SolveA. c1 c 0, c1, c c c1. soln Flatten; c c MatrixForm c1 1, c Out[798]//MatrixForm= 1 In[799]:= A.d c; eqn A. d1 d 1 ; eqns d1 d 1, d1 d ; soln Solveeqns, d1, d Flatten d d1. soln Flatten; d d MatrixForm Out[80]= d1 4, d 5
6 7.9 nonhomogeneous linear systems web.nb Out[804]//MatrixForm= 4 5 Assemble the solution to the original equation. In[805]:= xt Out[805]//MatrixForm= MapMatrixForm, a, b, c, d xt a t t b t c t d 4 1 b t t t t 5 b t t t t Out[806]= 1 1 b, 1 b, 1, 4 5 Out[807]= This agrees with our previous result if we take b = -1/. Example 7.9., Nonhomogeneous Linear System: Variation of Parameters Find the general solution of the following system. In[808]:= Cleara, x, x1, x, g, t, eqn, Λ, Λ1, Λ, Ξ, Ξ1, Ξ, Η, c1, c, u, u1, u; a 1 1 ; gt_ t t ; eqn : x't a.xt gt; Compute the eigensystem for this matrix. In[81]:= Out[81]= Λ Λ1, Λ Eigenvaluesa, 1 The eigenvalues are real and distinct. In[81]:= Out[81]= Ξ Ξ1, Ξ Eigenvectorsa 1, 1, 1, 1 Assemble two solutions of the homogeneous linear system.
7.9 nonhomogeneous linear systems web.nb 7 In[814]:= x1t_ Ξ1 Λ1 t xt_ Ξ Λ t Out[814]= t, t Out[815]= t, t In[816]:= Construct a fundamental matrix for this system. t_ Transposex1t, xt; Out[817]//MatrixForm= t t t t By variation of parameters, the solution to this nonhomogeneous system has the form... In[818]:= ut u1t, ut; xt_ t.ut; where u[t] satisfies... In[80]:= eqn t u't gt; Solve for u'[t]. In[81]:= Inverset.gt Out[81]//MatrixForm= t t t 1 t t Integrate to obtain u[t]. In[8]:= u1t_, ut_ Inverset.gt t c1, c Apart Flatten; Out[8]//MatrixForm= c1 t 1 6 t 1 t c t 1 t t In[84]:= xt FullSimplify Apart MatrixForm Out[84]//MatrixForm= c1 t 1 t 1 c t 1 c1 t 1 t 1 c t 1 4 t 5 6 t This agrees with our previous results. Definition of the Laplace Transform Let denote the Laplace Transform.
8 7.9 nonhomogeneous linear systems web.nb In[85]:= y_, t_, s_ : LaplaceTransformy, t, s Inverse Laplace Transform In[86]:= invy_, s_, t_ : InverseLaplaceTransformY, s, t; Example 7.9.4, Nonhomogeneous Linear System: Laplace Transforms Find the general solution of the following system. In[87]:= Cleara, x, x1, x, g, t, eqn, Λ, Λ1, Λ, Ξ, Ξ1, Ξ, Η, c1, c, u, u1, u; a 1 1 ; gt_ t, t; eqn : x't a.xt gt; Apply the Laplace Transform to our equation. In[81]:= eqnx s Xs X0 A.Xs Gs; In[8]:= Out[8]//MatrixForm= 1s s In[84]:= Out[85]//MatrixForm= Identify G[s]. Gs_ gt, t, s; Assume a particular initial condition. X0 0, 0; 0 0 We now must solve the following equation for X[s]. Multiply both sides by the inverse of (A-sI). In[86]:= Id IdentityMatrix; eqnx s Id A. Xs Gs; Xs_ Inverses Id A.Gs;
7.9 nonhomogeneous linear systems web.nb 9 Out[89]//MatrixForm= s s 4 ss 1s 4 ss 1s 4 ss s s 4 ss Apply the inverse Laplace transform to the components of X[s] to obtain x[t]. In[840]:= Out[840]= Xs s, s 4 s s 1 s 4 s s s 1 s 4 s s s 4 s s In[841]:= xt_ invxs, s, t; Out[84]//MatrixForm= 4 5 t t t t t t t t t t This agrees with our previous results.