71.9.15 problem 17

Internal problem ID [14423]
Book : Ordinary Differential Equations by Charles E. Roberts, Jr. CRC Press. 2010
Section : Chapter 4. N-th Order Linear Differential Equations. Exercises 4.1, page 186
Problem number : 17
Date solved : Monday, March 31, 2025 at 12:26:47 PM
CAS classification : [[_2nd_order, _with_linear_symmetries]]

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

With initial conditions

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

Maple. Time used: 0.037 (sec). Leaf size: 21
ode:=diff(diff(y(x),x),x)+9*y(x) = 27*x+18; 
ic:=y(0) = 23, D(y)(0) = 21; 
dsolve([ode,ic],y(x), singsol=all);
 
\[ y = 6 \sin \left (3 x \right )+21 \cos \left (3 x \right )+3 x +2 \]
Mathematica. Time used: 0.016 (sec). Leaf size: 22
ode=D[y[x],{x,2}]+9*y[x]==27*x+18; 
ic={y[0]==23,Derivative[1][y][0] ==21}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to 3 x+6 \sin (3 x)+21 \cos (3 x)+2 \]
Sympy. Time used: 0.085 (sec). Leaf size: 20
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-27*x + 9*y(x) + Derivative(y(x), (x, 2)) - 18,0) 
ics = {y(0): 23, Subs(Derivative(y(x), x), x, 0): 21} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = 3 x + 6 \sin {\left (3 x \right )} + 21 \cos {\left (3 x \right )} + 2 \]