63.17.1 problem 2

Internal problem ID [13121]
Book : A First Course in Differential Equations by J. David Logan. Third Edition. Springer-Verlag, NY. 2015.
Section : Chapter 3, Laplace transform. Section 3.4 Impulsive sources. Exercises page 173
Problem number : 2
Date solved : Wednesday, March 05, 2025 at 09:17:45 PM
CAS classification : [[_linear, `class A`]]

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

Using Laplace method With initial conditions

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

Maple. Time used: 9.410 (sec). Leaf size: 38
ode:=diff(x(t),t)+3*x(t) = Dirac(t-1)+Heaviside(t-4); 
ic:=x(0) = 1; 
dsolve([ode,ic],x(t),method='laplace');
 
\[ x \left (t \right ) = \operatorname {Heaviside}\left (t -1\right ) {\mathrm e}^{-3 t +3}-\frac {\operatorname {Heaviside}\left (t -4\right ) {\mathrm e}^{-3 t +12}}{3}+\frac {\operatorname {Heaviside}\left (t -4\right )}{3}+{\mathrm e}^{-3 t} \]
Mathematica. Time used: 0.684 (sec). Leaf size: 132
ode=D[x[t],t]+3*x[t]==DiracDelta[t-1]+UnitStep[t-4]; 
ic={x[0]==1}; 
DSolve[{ode,ic},x[t],t,IncludeSingularSolutions->True]
 
\[ x(t)\to \theta (4-t) \left (\frac {1}{3} e^{-3 t} \left (-3 \int _1^te^{3 K[2]} (\delta (K[2]-1)+1)dK[2]+e^3 (3 \theta (0)-4)+e^{12}-3\right )+e^{-3 t} \left (\int _0^te^3 \delta (K[1]-1)dK[1]+1\right )\right )-\frac {1}{3} e^{-3 t} \left (-3 \int _1^te^{3 K[2]} (\delta (K[2]-1)+1)dK[2]+e^3 (3 \theta (0)-4)+e^{12}-3\right ) \]
Sympy. Time used: 0.918 (sec). Leaf size: 63
from sympy import * 
t = symbols("t") 
x = Function("x") 
ode = Eq(-Dirac(t - 1) + 3*x(t) - Heaviside(t - 4) + Derivative(x(t), t),0) 
ics = {x(0): 1} 
dsolve(ode,func=x(t),ics=ics)
 
\[ - \frac {\left (e^{3 t} - e^{12}\right ) \theta \left (t - 4\right )}{3} - \int \operatorname {Dirac}{\left (t - 1 \right )} e^{3 t}\, dt + 3 \int x{\left (t \right )} e^{3 t}\, dt = - \int \limits ^{0} \operatorname {Dirac}{\left (t - 1 \right )} e^{3 t}\, dt + 3 \int \limits ^{0} x{\left (t \right )} e^{3 t}\, dt \]