12.2.4 problem Problem 15.4

Internal problem ID [3487]
Book : Mathematical methods for physics and engineering, Riley, Hobson, Bence, second edition, 2002
Section : Chapter 15, Higher order ordinary differential equations. 15.4 Exercises, page 523
Problem number : Problem 15.4
Date solved : Tuesday, September 30, 2025 at 06:40:41 AM
CAS classification : [[_2nd_order, _with_linear_symmetries]]

\begin{align*} f^{\prime \prime }+6 f^{\prime }+9 f&={\mathrm e}^{-t} \end{align*}

With initial conditions

\begin{align*} f \left (0\right )&=0 \\ f^{\prime }\left (0\right )&=\lambda \\ \end{align*}
Maple. Time used: 0.029 (sec). Leaf size: 23
ode:=diff(diff(f(t),t),t)+6*diff(f(t),t)+9*f(t) = exp(-t); 
ic:=[f(0) = 0, D(f)(0) = lambda]; 
dsolve([ode,op(ic)],f(t), singsol=all);
 
\[ f = \frac {\left ({\mathrm e}^{2 t}-1+\left (4 \lambda -2\right ) t \right ) {\mathrm e}^{-3 t}}{4} \]
Mathematica. Time used: 0.019 (sec). Leaf size: 28
ode=D[ f[t],{t,2}]+6*D[ f[t],t]+9*f[t]==Exp[-t]; 
ic={f[0]==0,Derivative[1][f][0]==\[Lambda]}; 
DSolve[{ode,ic},f[t],t,IncludeSingularSolutions->True]
 
\begin{align*} f(t)&\to \frac {1}{4} e^{-3 t} \left ((4 \lambda -2) t+e^{2 t}-1\right ) \end{align*}
Sympy. Time used: 0.171 (sec). Leaf size: 24
from sympy import * 
t = symbols("t") 
f = Function("f") 
ode = Eq(9*f(t) + 6*Derivative(f(t), t) + Derivative(f(t), (t, 2)) - exp(-t),0) 
ics = {f(0): 0, Subs(Derivative(f(t), t), t, 0): lambda_} 
dsolve(ode,func=f(t),ics=ics)
 
\[ f{\left (t \right )} = \left (\left (t \left (\lambda _{} - \frac {1}{2}\right ) - \frac {1}{4}\right ) e^{- 2 t} + \frac {1}{4}\right ) e^{- t} \]