90.27.3 problem 3

Internal problem ID [25413]
Book : Ordinary Differential Equations. By William Adkins and Mark G Davidson. Springer. NY. 2010. ISBN 978-1-4614-3617-1
Section : Chapter 6. Discontinuous Functions and the Laplace Transform. Exercises at page 425
Problem number : 3
Date solved : Friday, October 03, 2025 at 12:01:17 AM
CAS classification : [[_linear, `class A`]]

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

Using Laplace method With initial conditions

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