73.15.15 problem 22.6

Internal problem ID [15375]
Book : Ordinary Differential Equations. An introduction to the fundamentals. Kenneth B. Howell. second edition. CRC Press. FL, USA. 2020
Section : Chapter 22. Method of undetermined coefficients. Additional exercises page 412
Problem number : 22.6
Date solved : Monday, March 31, 2025 at 01:35:52 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y^{\prime \prime }+9 y&=x^{3} \end{align*}

With initial conditions

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

Maple. Time used: 0.031 (sec). Leaf size: 19
ode:=diff(diff(y(x),x),x)+9*y(x) = x^3; 
ic:=y(0) = 0, D(y)(0) = 0; 
dsolve([ode,ic],y(x), singsol=all);
 
\[ y = \frac {2 \sin \left (3 x \right )}{81}+\frac {x^{3}}{9}-\frac {2 x}{27} \]
Mathematica. Time used: 0.014 (sec). Leaf size: 24
ode=D[y[x],{x,2}]+9*y[x]==x^3; 
ic={y[0]==0,Derivative[1][y][0] ==0}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \frac {1}{81} \left (9 x^3-6 x+2 \sin (3 x)\right ) \]
Sympy. Time used: 0.110 (sec). Leaf size: 20
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-x**3 + 9*y(x) + Derivative(y(x), (x, 2)),0) 
ics = {y(0): 0, Subs(Derivative(y(x), x), x, 0): 0} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \frac {x^{3}}{9} - \frac {2 x}{27} + \frac {2 \sin {\left (3 x \right )}}{81} \]