64.20.15 problem 15

Internal problem ID [13587]
Book : Differential Equations by Shepley L. Ross. Third edition. John Willey. New Delhi. 2004.
Section : Chapter 9, The Laplace transform. Section 9.3, Exercises page 452
Problem number : 15
Date solved : Monday, March 31, 2025 at 08:01:54 AM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y^{\prime \prime }+4 y^{\prime }+5 y&=\left \{\begin {array}{cc} 1 & 0<t <\frac {\pi }{2} \\ 0 & \frac {\pi }{2}<t \end {array}\right . \end{align*}

Using Laplace method With initial conditions

\begin{align*} y \left (0\right )&=0\\ y^{\prime }\left (0\right )&=1 \end{align*}

Maple. Time used: 0.507 (sec). Leaf size: 59
ode:=diff(diff(y(t),t),t)+4*diff(y(t),t)+5*y(t) = piecewise(0 < t and t < 1/2*Pi,1,1/2*Pi < t,0); 
ic:=y(0) = 0, D(y)(0) = 1; 
dsolve([ode,ic],y(t),method='laplace');
 
\[ y = \frac {\left (\left \{\begin {array}{cc} 1+{\mathrm e}^{-2 t} \left (3 \sin \left (t \right )-\cos \left (t \right )\right ) & t <\frac {\pi }{2} \\ \frac {{\mathrm e}^{\left (-2-i\right ) t} \left (-1+3 i+\left (-1-3 i\right ) {\mathrm e}^{2 i t}+\left (-2-i\right ) {\mathrm e}^{2 i t +\pi }+\left (-2+i\right ) {\mathrm e}^{\pi }\right )}{2} & \frac {\pi }{2}\le t \end {array}\right .\right )}{5} \]
Mathematica. Time used: 0.047 (sec). Leaf size: 81
ode=D[y[t],{t,2}]+4*D[y[t],t]+5*y[t]==Piecewise[{{1,0<t<Pi/2},{0,t>Pi/2}}]; 
ic={y[0]==0,Derivative[1][y][0]==1}; 
DSolve[{ode,ic},{y[t]},t,IncludeSingularSolutions->True]
 
\[ y(t)\to \begin {array}{cc} \{ & \begin {array}{cc} e^{-2 t} \sin (t) & t\leq 0 \\ \frac {1}{5} e^{-2 t} \left (-\cos (t)+e^{2 t}+3 \sin (t)\right ) & t>0\land 2 t\leq \pi \\ \frac {1}{5} e^{-2 t} \left (\left (3+e^{\pi }\right ) \sin (t)-\left (1+2 e^{\pi }\right ) \cos (t)\right ) & \text {True} \\ \end {array} \\ \end {array} \]
Sympy
from sympy import * 
t = symbols("t") 
y = Function("y") 
ode = Eq(-Piecewise((1, (t > 0) & (t < pi/2)), (0, t > pi/2)) + 5*y(t) + 4*Derivative(y(t), t) + Derivative(y(t), (t, 2)),0) 
ics = {y(0): 0, Subs(Derivative(y(t), t), t, 0): 1} 
dsolve(ode,func=y(t),ics=ics)