67.4.29 problem Problem 4(e)

Internal problem ID [13994]
Book : APPLIED DIFFERENTIAL EQUATIONS The Primary Course by Vladimir A. Dobrushkin. CRC Press 2015
Section : Chapter 5.6 Laplace transform. Nonhomogeneous equations. Problems page 368
Problem number : Problem 4(e)
Date solved : Friday, March 14, 2025 at 12:18:02 AM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

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

Using Laplace method With initial conditions

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

Maple. Time used: 12.163 (sec). Leaf size: 40
ode:=diff(diff(y(t),t),t)+4*y(t) = piecewise(0 <= t and t < 1/2*Pi,8*t,1/2*Pi <= t,8*Pi); 
ic:=y(0) = 0, D(y)(0) = 0; 
dsolve([ode,ic],y(t),method='laplace');
 
\[ y = \left \{\begin {array}{cc} -\sin \left (2 t \right )+2 t & t <\frac {\pi }{2} \\ -2 \sin \left (2 t \right )+2 \cos \left (t \right )^{2} \pi +\pi & \frac {\pi }{2}\le t \end {array}\right . \]
Mathematica. Time used: 0.041 (sec). Leaf size: 48
ode=D[y[t],{t,2}]+4*y[t]==Piecewise[{{8*t,0<=t<Pi/2},{8*Pi,t>=Pi/2}}]; 
ic={y[0]==0,Derivative[1][y][0] ==0}; 
DSolve[{ode,ic},y[t],t,IncludeSingularSolutions->True]
 
\[ y(t)\to \begin {array}{cc} \{ & \begin {array}{cc} 0 & t\leq 0 \\ 2 t-\sin (2 t) & t>0\land 2 t\leq \pi \\ \pi \cos (2 t)-2 \sin (2 t)+2 \pi & \text {True} \\ \end {array} \\ \end {array} \]
Sympy. Time used: 0.498 (sec). Leaf size: 19
from sympy import * 
t = symbols("t") 
y = Function("y") 
ode = Eq(-Piecewise((8*t, (t >= 0) & (t < pi/2)), (8*pi, t >= pi/2)) + 4*y(t) + Derivative(y(t), (t, 2)),0) 
ics = {y(0): 0, Subs(Derivative(y(t), t), t, 0): 0} 
dsolve(ode,func=y(t),ics=ics)
 
\[ y{\left (t \right )} = \begin {cases} 2 t & \text {for}\: t \geq 0 \wedge t < \frac {\pi }{2} \\2 \pi & \text {for}\: t \geq \frac {\pi }{2} \\\text {NaN} & \text {otherwise} \end {cases} - \sin {\left (2 t \right )} \]