63.17.3 problem 4

Internal problem ID [13123]
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 : 4
Date solved : Wednesday, March 05, 2025 at 09:17:47 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} x^{\prime \prime }+x&=\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 )&=0 \end{align*}

Maple. Time used: 8.943 (sec). Leaf size: 13
ode:=diff(diff(x(t),t),t)+x(t) = Dirac(t-2); 
ic:=x(0) = 0, D(x)(0) = 0; 
dsolve([ode,ic],x(t),method='laplace');
 
\[ x \left (t \right ) = \operatorname {Heaviside}\left (t -2\right ) \sin \left (t -2\right ) \]
Mathematica. Time used: 0.059 (sec). Leaf size: 82
ode=D[x[t],{t,2}]+x[t]==DiracDelta[t-2]; 
ic={x[0]==0,Derivative[1][x][0 ]==0}; 
DSolve[{ode,ic},x[t],t,IncludeSingularSolutions->True]
 
\[ x(t)\to -\sin (t) \int _1^0\cos (2) \delta (K[2]-2)dK[2]+\sin (t) \int _1^t\cos (2) \delta (K[2]-2)dK[2]-\cos (t) \int _1^0-\delta (K[1]-2) \sin (2)dK[1]+\cos (t) \int _1^t-\delta (K[1]-2) \sin (2)dK[1] \]
Sympy. Time used: 0.670 (sec). Leaf size: 49
from sympy import * 
t = symbols("t") 
x = Function("x") 
ode = Eq(-Dirac(t - 2) + x(t) + Derivative(x(t), (t, 2)),0) 
ics = {x(0): 0, Subs(Derivative(x(t), t), t, 0): 0} 
dsolve(ode,func=x(t),ics=ics)
 
\[ x{\left (t \right )} = \left (- \int \operatorname {Dirac}{\left (t - 2 \right )} \sin {\left (t \right )}\, dt + \int \limits ^{0} \operatorname {Dirac}{\left (t - 2 \right )} \sin {\left (t \right )}\, dt\right ) \cos {\left (t \right )} + \left (\int \operatorname {Dirac}{\left (t - 2 \right )} \cos {\left (t \right )}\, dt - \int \limits ^{0} \operatorname {Dirac}{\left (t - 2 \right )} \cos {\left (t \right )}\, dt\right ) \sin {\left (t \right )} \]