Exercise 3.6.26

a = 1;
b =  2;
c = 5;
RHS[t_] :=  
      3 t Exp[-t] Cos[2  t]  -  
        2 t Exp[-2 t] Cos[t]
charEqn  =  (a r^2  +  b r  +  c  ==  
          0)
charSoln  =  Solve[charEqn,  r]

Conclude that the solutions to the homogeneous equation are
Exp[-t] Cos[2t] and Exp[-t] Sin[2t].  
Note that the RHS includes the summand
t Exp[-t] Cos[2t].  
Therefore the guessed solution to the inhomogenous equation must include 
t(A1 + A2  t) Exp[-t] Cos[2t] +
  		 t (A3+  A4 t) Exp[-t] Sin[2t]

Clear[yp,  LHS]
\(yp[t_]\  := \ 
      t \((A1\  + \ A2\ \ t)\)\ Exp[\(-t\)]\ Cos[
            2  t]\  + 
		\ t\ \((A3 + \ \ A4\ t)\)\ Exp[\(-t\)]\ Sin[
            2  t]\  + 
		\((A5\  + \ 
              A6\ t)\)\ \ Exp[\(-2\)\ t]\ Cos[
            t]\ \  + 
		\((A7\  + \ A8\ t)\) 
          Exp[\(-2\)\ t]\ Sin[t]\)
LHS[t_]   =  
      Expand[a yp''[t]   +  b yp'[t]  +  c yp[t]]

In the following, I make a table of linear equations each of the form
jth derivative of LHS at t=0 equals jth derivative of RHS at t=0,
for j = 0, 1, 2, ...,7   .
The jth derivative of the LHS at t= 0 is obtrained by the code:
(D[LHS[t], {t,j}]/.t-> 0)

linearEquations  =  
      Table[
(D[LHS[t],  {t, j}] /. 
              t ->  0)  == 
(D[
                RHS[t],  {t, j}] /. t ->  0) ,  {j, 0, 
          7}]

    Solve[
      linearEquations,  { A1,  A2,  A3,  A4,  A5,  A6,  A7, 
        A8}]

Exercise 3.6.29

\(\(\(
\)\(Clear[eqn, \ y, \ InitialConditions, 
      F]


    eqn\  = \ \((1\ \(y''\)[t]\  + \ 2\ \(y'\)[t]\  + \ 5\ y[t]\  == \ 
          1)\)

    InitialConditions\  = \ {
y[0]\  == \ 
          0, \ 
\(y'\)[0]\  == \ 
          0
}

    \(Soln\  = \ 
        DSolve[{eqn, \ InitialConditions}, \ y[t], \ t];\)

    F[t_]\  = \ Expand[\ Simplify[y[t] /. \ Soln[\([1]\)]]]\)\)\)

Clear[eqn,  y,  InitialConditions, 
      G]
eqn  =  (1 y''[t]  +  
            2 y'[t]  +  5 y[t]  ==  
          0)
InitialConditions  = {y[Pi/2]  == F[(π/2)],
y'[Pi/2] ==F'[(π/2)]}
Soln  =  
        DSolve[{eqn,  InitialConditions},  y[t],  
          t];
G[t_]  =  
      Expand[ Simplify[y[t] /.  Soln[[1]]]]

G[Pi/2]
G'[Pi/2]