61.4.25 problem Problem 4(a)

Internal problem ID [15350]
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(a)
Date solved : Thursday, October 02, 2025 at 10:11:56 AM
CAS classification : [[_2nd_order, _missing_y]]

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

Using Laplace method With initial conditions

\begin{align*} y \left (0\right )&=-6 \\ y^{\prime }\left (0\right )&=1 \\ \end{align*}
Maple. Time used: 0.234 (sec). Leaf size: 52
ode:=diff(diff(y(t),t),t)-2*diff(y(t),t) = piecewise(0 <= t and t < 1,4,1 <= t,6); 
ic:=[y(0) = -6, D(y)(0) = 1]; 
dsolve([ode,op(ic)],y(t),method='laplace');
 
\[ y = -\frac {\left (\left \{\begin {array}{cc} 15+4 t -3 \,{\mathrm e}^{2 t} & t <1 \\ 20-3 \,{\mathrm e}^{2} & t =1 \\ 14+6 t -3 \,{\mathrm e}^{2 t}-{\mathrm e}^{-2+2 t} & 1<t \end {array}\right .\right )}{2} \]
Mathematica. Time used: 0.021 (sec). Leaf size: 68
ode=D[y[t],{t,2}]-2*D[y[t],t]==Piecewise[{{4,0<=t<1},{6,t>=1}}]; 
ic={y[0]==-6,Derivative[1][y][0] ==1}; 
DSolve[{ode,ic},y[t],t,IncludeSingularSolutions->True]
 
\begin{align*} y(t)&\to \begin {array}{cc} \{ & \begin {array}{cc} \frac {1}{2} \left (-13+e^{2 t}\right ) & t\leq 0 \\ \frac {1}{2} \left (-4 t+3 e^{2 t}-15\right ) & 0<t\leq 1 \\ \frac {1}{2} \left (-6 t+3 e^{2 t}+e^{2 t-2}-14\right ) & \text {True} \\ \end {array} \\ \end {array} \end{align*}
Sympy
from sympy import * 
t = symbols("t") 
y = Function("y") 
ode = Eq(-Piecewise((4, (t >= 0) & (t < 1)), (6, t >= 1)) - 2*Derivative(y(t), t) + Derivative(y(t), (t, 2)),0) 
ics = {y(0): -6, Subs(Derivative(y(t), t), t, 0): 1} 
dsolve(ode,func=y(t),ics=ics)
 
ValueError : function with different numbers of args