76.20.6 problem 6

Internal problem ID [17683]
Book : Differential equations. An introduction to modern methods and applications. James Brannan, William E. Boyce. Third edition. Wiley 2015
Section : Chapter 5. The Laplace transform. Section 5.6 (Differential equations with Discontinuous Forcing Functions). Problems at page 342
Problem number : 6
Date solved : Monday, March 31, 2025 at 04:24:27 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y^{\prime \prime }+3 y^{\prime }+2 y&=\operatorname {Heaviside}\left (t -2\right ) \end{align*}

Using Laplace method With initial conditions

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

Maple. Time used: 0.155 (sec). Leaf size: 47
ode:=diff(diff(y(t),t),t)+3*diff(y(t),t)+2*y(t) = Heaviside(t-2); 
ic:=y(0) = 6, D(y)(0) = 6; 
dsolve([ode,ic],y(t),method='laplace');
 
\[ y = -12 \,{\mathrm e}^{-2 t}+18 \,{\mathrm e}^{-t}+\frac {\operatorname {Heaviside}\left (t -2\right ) {\mathrm e}^{4-2 t}}{2}-\operatorname {Heaviside}\left (t -2\right ) {\mathrm e}^{-t +2}+\frac {\operatorname {Heaviside}\left (t -2\right )}{2} \]
Mathematica. Time used: 0.027 (sec). Leaf size: 55
ode=D[y[t],{t,2}]+3*D[y[t],t]+2*y[t]==UnitStep[t-2]; 
ic={y[0]==6,Derivative[1][y][0] ==6}; 
DSolve[{ode,ic},y[t],t,IncludeSingularSolutions->True]
 
\[ y(t)\to \frac {1}{2} e^{-2 t} \left (\left (e^2-e^t\right )^2 (-\theta (2-t))+36 e^t+e^{2 t}-2 e^{t+2}+e^4-24\right ) \]
Sympy. Time used: 0.587 (sec). Leaf size: 44
from sympy import * 
t = symbols("t") 
y = Function("y") 
ode = Eq(2*y(t) - Heaviside(t - 2) + 3*Derivative(y(t), t) + Derivative(y(t), (t, 2)),0) 
ics = {y(0): 6, Subs(Derivative(y(t), t), t, 0): 6} 
dsolve(ode,func=y(t),ics=ics)
 
\[ y{\left (t \right )} = \left (- e^{2} \theta \left (t - 2\right ) + 18\right ) e^{- t} + \left (\frac {e^{4} \theta \left (t - 2\right )}{2} - 12\right ) e^{- 2 t} + \frac {\theta \left (t - 2\right )}{2} \]