82.4.17 problem 28-17

Internal problem ID [21835]
Book : The Differential Equations Problem Solver. VOL. II. M. Fogiel director. REA, NY. 1978. ISBN 78-63609
Section : Chapter 28. Laplace transforms. Page 850
Problem number : 28-17
Date solved : Thursday, October 02, 2025 at 08:02:41 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

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

Using Laplace method With initial conditions

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