7.21.8 problem 8

Internal problem ID [571]
Book : Elementary Differential Equations. By C. Henry Edwards, David E. Penney and David Calvis. 6th edition. 2008
Section : Chapter 4. Laplace transform methods. Section 4.6 (Impulses and Delta functions). Problems at page 324
Problem number : 8
Date solved : Saturday, March 29, 2025 at 04:56:57 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} x^{\prime \prime }+2 x^{\prime }+x&=\delta \left (t \right )-\delta \left (t -2\right ) \end{align*}

Using Laplace method With initial conditions

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

Maple. Time used: 0.119 (sec). Leaf size: 24
ode:=diff(diff(x(t),t),t)+2*diff(x(t),t)+x(t) = Dirac(t)-Dirac(t-2); 
ic:=x(0) = 0, D(x)(0) = 2; 
dsolve([ode,ic],x(t),method='laplace');
 
\[ x = -\left ({\mathrm e}^{2} \left (t -2\right ) \operatorname {Heaviside}\left (t -2\right )-3 t \right ) {\mathrm e}^{-t} \]
Mathematica. Time used: 0.043 (sec). Leaf size: 34
ode=D[x[t],{t,2}]+2*D[x[t],t]+x[t]==DiracDelta[t]-DiracDelta[t-2]; 
ic={x[0]==0,Derivative[1][x][0] ==2}; 
DSolve[{ode,ic},x[t],t,IncludeSingularSolutions->True]
 
\[ x(t)\to e^{-t} \left (t (\theta (t)-\theta (0)+2)-e^2 (t-2) \theta (t-2)\right ) \]
Sympy. Time used: 3.398 (sec). Leaf size: 82
from sympy import * 
t = symbols("t") 
x = Function("x") 
ode = Eq(-Dirac(t) + Dirac(t - 2) + x(t) + 2*Derivative(x(t), t) + Derivative(x(t), (t, 2)),0) 
ics = {x(0): 0, Subs(Derivative(x(t), t), t, 0): 2} 
dsolve(ode,func=x(t),ics=ics)
 
\[ x{\left (t \right )} = \left (t \left (- \int \left (- \operatorname {Dirac}{\left (t \right )} + \operatorname {Dirac}{\left (t - 2 \right )}\right ) e^{t}\, dt + \int \limits ^{0} \left (- \operatorname {Dirac}{\left (t \right )} e^{t}\right )\, dt + \int \limits ^{0} \operatorname {Dirac}{\left (t - 2 \right )} e^{t}\, dt + 2\right ) + \int t \left (- \operatorname {Dirac}{\left (t \right )} + \operatorname {Dirac}{\left (t - 2 \right )}\right ) e^{t}\, dt - \int \limits ^{0} \left (- t \operatorname {Dirac}{\left (t \right )} e^{t}\right )\, dt - \int \limits ^{0} t \operatorname {Dirac}{\left (t - 2 \right )} e^{t}\, dt\right ) e^{- t} \]