71.16.2 problem 2

Internal problem ID [14480]
Book : Ordinary Differential Equations by Charles E. Roberts, Jr. CRC Press. 2010
Section : Chapter 5. The Laplace Transform Method. Exercises 5.5, page 273
Problem number : 2
Date solved : Monday, March 31, 2025 at 12:28:15 PM
CAS classification : [[_linear, `class A`]]

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

Using Laplace method With initial conditions

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

Maple. Time used: 0.126 (sec). Leaf size: 34
ode:=diff(y(x),x)-3*y(x) = Dirac(x-1)+2*Heaviside(x-2); 
ic:=y(0) = 0; 
dsolve([ode,ic],y(x),method='laplace');
 
\[ y = -\frac {2 \operatorname {Heaviside}\left (x -2\right )}{3}+\frac {2 \operatorname {Heaviside}\left (x -2\right ) {\mathrm e}^{3 x -6}}{3}+\operatorname {Heaviside}\left (x -1\right ) {\mathrm e}^{3 x -3} \]
Mathematica. Time used: 0.686 (sec). Leaf size: 134
ode=D[y[x],x]-3*y[x]==DiracDelta[x-1]+2*UnitStep[x-2]; 
ic={y[0]==0}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \theta (2-x) \left (e^{3 x} \int _0^x\frac {\delta (K[1]-1)}{e^3}dK[1]-\frac {1}{3} e^{3 x-6} \left (3 e^6 \int _1^xe^{-3 K[2]} (\delta (K[2]-1)+2)dK[2]-3 e^3 \theta (0)+e^3+2\right )\right )+\frac {1}{3} e^{3 x-6} \left (3 e^6 \int _1^xe^{-3 K[2]} (\delta (K[2]-1)+2)dK[2]-3 e^3 \theta (0)+e^3+2\right ) \]
Sympy. Time used: 0.923 (sec). Leaf size: 71
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-Dirac(x - 1) - 3*y(x) - 2*Heaviside(x - 2) + Derivative(y(x), x),0) 
ics = {y(0): 0} 
dsolve(ode,func=y(x),ics=ics)
 
\[ - \frac {2 \left (e^{-6} - e^{- 3 x}\right ) \theta \left (x - 2\right )}{3} - \int \operatorname {Dirac}{\left (x - 1 \right )} e^{- 3 x}\, dx - 3 \int y{\left (x \right )} e^{- 3 x}\, dx = - \int \limits ^{0} \operatorname {Dirac}{\left (x - 1 \right )} e^{- 3 x}\, dx - 3 \int \limits ^{0} y{\left (x \right )} e^{- 3 x}\, dx \]