76.18.5 problem 16

Internal problem ID [17645]
Book : Differential equations. An introduction to modern methods and applications. James Brannan, William E. Boyce. Third edition. Wiley 2015
Section : Chapter 5. The Laplace transform. Section 5.2 (Properties of the Laplace transform). Problems at page 309
Problem number : 16
Date solved : Monday, March 31, 2025 at 04:23:30 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y^{\prime \prime }-2 y^{\prime }+2 y&=t^{2} {\mathrm e}^{t}+7 \end{align*}

Using Laplace method With initial conditions

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

Maple. Time used: 0.101 (sec). Leaf size: 25
ode:=diff(diff(y(t),t),t)-2*diff(y(t),t)+2*y(t) = t^2*exp(t)+7; 
ic:=y(0) = 1, D(y)(0) = 1; 
dsolve([ode,ic],y(t),method='laplace');
 
\[ y = \frac {7}{2}+\frac {\left (2 t^{2}-\cos \left (t \right )+7 \sin \left (t \right )-4\right ) {\mathrm e}^{t}}{2} \]
Mathematica. Time used: 0.36 (sec). Leaf size: 38
ode=D[y[t],{t,2}]-2*D[y[t],t]+2*y[t]==t^2*Exp[t]+7; 
ic={y[0]==1,Derivative[1][y][0] == 1}; 
DSolve[{ode,ic},y[t],t,IncludeSingularSolutions->True]
 
\[ y(t)\to \frac {1}{2} \left (2 e^t t^2-4 e^t+7 e^t \sin (t)-e^t \cos (t)+7\right ) \]
Sympy. Time used: 0.259 (sec). Leaf size: 26
from sympy import * 
t = symbols("t") 
y = Function("y") 
ode = Eq(-t**2*exp(t) + 2*y(t) - 2*Derivative(y(t), t) + Derivative(y(t), (t, 2)) - 7,0) 
ics = {y(0): 1, Subs(Derivative(y(t), t), t, 0): 1} 
dsolve(ode,func=y(t),ics=ics)
 
\[ y{\left (t \right )} = \left (t^{2} + \frac {7 \sin {\left (t \right )}}{2} - \frac {\cos {\left (t \right )}}{2} - 2\right ) e^{t} + \frac {7}{2} \]