62.3.3 problem 6.3 (d)

Internal problem ID [15437]
Book : Differential Equations, Linear, Nonlinear, Ordinary, Partial. A.C. King, J.Billingham, S.R.Otto. Cambridge Univ. Press 2003
Section : Chapter 6. Laplace transforms. Problems page 172
Problem number : 6.3 (d)
Date solved : Thursday, October 02, 2025 at 10:14:09 AM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y^{\prime \prime }-4 y^{\prime }+4 y&=\left \{\begin {array}{cc} t & 0\le t \le 3 \\ t +2 & 3<t \end {array}\right . \end{align*}

Using Laplace method With initial conditions

\begin{align*} y \left (0\right )&=-2 \\ y^{\prime }\left (0\right )&=1 \\ \end{align*}
Maple. Time used: 0.170 (sec). Leaf size: 66
ode:=diff(diff(y(t),t),t)-4*diff(y(t),t)+4*y(t) = piecewise(0 <= t and t <= 3,t,3 < t,t+2); 
ic:=[y(0) = -2, D(y)(0) = 1]; 
dsolve([ode,op(ic)],y(t),method='laplace');
 
\[ y = \frac {\left (\left \{\begin {array}{cc} \frac {1}{2}+\frac {3 \left (-3+7 t \right ) {\mathrm e}^{2 t}}{2}+\frac {t}{2} & t <3 \\ 3+27 \,{\mathrm e}^{6} & t =3 \\ \frac {3}{2}+{\mathrm e}^{-6+2 t} \left (2 t -7\right )+\frac {3 \left (-3+7 t \right ) {\mathrm e}^{2 t}}{2}+\frac {t}{2} & 3<t \end {array}\right .\right )}{2} \]
Mathematica. Time used: 0.029 (sec). Leaf size: 81
ode=D[y[t],{t,2}]-4*D[y[t],t]+4*y[t]==Piecewise[{{t,0<=t<=3},{t+2,3<t}}]; 
ic={y[0]==-2,Derivative[1][y][0] ==1}; 
DSolve[{ode,ic},y[t],t,IncludeSingularSolutions->True]
 
\begin{align*} y(t)&\to \begin {array}{cc} \{ & \begin {array}{cc} e^{2 t} (5 t-2) & t\leq 0 \\ \frac {1}{4} \left (t+3 e^{2 t} (7 t-3)+1\right ) & 0<t\leq 3 \\ \frac {1}{4} \left (t+2 e^{2 t-6} (2 t-7)+3 e^{2 t} (7 t-3)+3\right ) & \text {True} \\ \end {array} \\ \end {array} \end{align*}
Sympy
from sympy import * 
t = symbols("t") 
y = Function("y") 
ode = Eq(-Piecewise((t, (t >= 0) & (t <= 3)), (t + 2, t > 3)) + 4*y(t) - 4*Derivative(y(t), t) + Derivative(y(t), (t, 2)),0) 
ics = {y(0): -2, Subs(Derivative(y(t), t), t, 0): 1} 
dsolve(ode,func=y(t),ics=ics)