71.16.4 problem 4

Internal problem ID [14474]
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 : 4
Date solved : Thursday, March 13, 2025 at 03:31:11 AM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

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

Using Laplace method With initial conditions

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

Maple. Time used: 10.121 (sec). Leaf size: 22
ode:=diff(diff(y(x),x),x)-2*diff(y(x),x)+y(x) = 2*Dirac(x-1); 
ic:=y(0) = 0, D(y)(0) = 1; 
dsolve([ode,ic],y(x),method='laplace');
 
\[ y = 2 \operatorname {Heaviside}\left (x -1\right ) {\mathrm e}^{x -1} \left (x -1\right )+{\mathrm e}^{x} x \]
Mathematica. Time used: 0.027 (sec). Leaf size: 89
ode=D[y[x],{x,2}]-2*D[y[x],x]+y[x]==2*DiracDelta[x-1]; 
ic={y[0]==0,Derivative[1][y][0] ==1}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to -e^x \left (x \int _1^0\frac {2 \delta (K[2]-1)}{e}dK[2]-x \int _1^x\frac {2 \delta (K[2]-1)}{e}dK[2]-\int _1^x-\frac {2 \delta (K[1]-1)}{e}dK[1]+\int _1^0-\frac {2 \delta (K[1]-1)}{e}dK[1]-x\right ) \]
Sympy. Time used: 1.731 (sec). Leaf size: 60
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-2*Dirac(x - 1) + y(x) - 2*Derivative(y(x), x) + Derivative(y(x), (x, 2)),0) 
ics = {y(0): 0, Subs(Derivative(y(x), x), x, 0): 1} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \left (x \left (2 \int \operatorname {Dirac}{\left (x - 1 \right )} e^{- x}\, dx - 2 \int \limits ^{0} \operatorname {Dirac}{\left (x - 1 \right )} e^{- x}\, dx + 1\right ) - 2 \int x \operatorname {Dirac}{\left (x - 1 \right )} e^{- x}\, dx + 2 \int \limits ^{0} x \operatorname {Dirac}{\left (x - 1 \right )} e^{- x}\, dx\right ) e^{x} \]