65.15.4 problem 4 (d)

Internal problem ID [15833]
Book : Ordinary Differential Equations by Charles E. Roberts, Jr. CRC Press. 2010
Section : Chapter 5. The Laplace Transform Method. Exercises 5.4, page 265
Problem number : 4 (d)
Date solved : Thursday, October 02, 2025 at 10:28:26 AM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y-2 y^{\prime }+y^{\prime \prime }&=\left \{\begin {array}{cc} 0 & 0\le x <1 \\ x^{2}-2 x +3 & 1\le x \end {array}\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: 0.132 (sec). Leaf size: 43
ode:=diff(diff(y(x),x),x)-2*diff(y(x),x)+y(x) = piecewise(0 <= x and x < 1,0,1 <= x,x^2-2*x+3); 
ic:=[y(0) = 0, D(y)(0) = 1]; 
dsolve([ode,op(ic)],y(x),method='laplace');
 
\[ y = \left \{\begin {array}{cc} {\mathrm e}^{x} x & x <1 \\ {\mathrm e}+8 & x =1 \\ {\mathrm e}^{x} x +5+4 \left (x -3\right ) {\mathrm e}^{x -1}+x^{2}+2 x & 1<x \end {array}\right . \]
Mathematica. Time used: 0.021 (sec). Leaf size: 39
ode=D[y[x],{x,2}]-2*D[y[x],x]+y[x]==Piecewise[{ {0,0<=x<1},{x^2-2*x+3,x>=1}}]; 
ic={y[0]==0,Derivative[1][y][0] ==1}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to \begin {array}{cc} \{ & \begin {array}{cc} e^x x & x\leq 1 \\ x^2+e^x x+2 x+4 e^{x-1} (x-3)+5 & \text {True} \\ \end {array} \\ \end {array} \end{align*}
Sympy
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-Piecewise((0, (x >= 0) & (x < 1)), (x**2 - 2*x + 3, 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)