23.2.14 problem 6(c)

Internal problem ID [4131]
Book : Theory and solutions of Ordinary Differential equations, Donald Greenspan, 1960
Section : Chapter 3. Linear differential equations of second order. Exercises at page 31
Problem number : 6(c)
Date solved : Sunday, March 30, 2025 at 02:40:36 AM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

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

Maple. Time used: 0.003 (sec). Leaf size: 19
ode:=diff(diff(y(x),x),x)+y(x) = x^3+x; 
dsolve(ode,y(x), singsol=all);
 
\[ y = \sin \left (x \right ) c_2 +\cos \left (x \right ) c_1 +x^{3}-5 x \]
Mathematica. Time used: 0.013 (sec). Leaf size: 22
ode=D[y[x],{x,2}]+y[x]==x^3+x; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to x^3-5 x+c_1 \cos (x)+c_2 \sin (x) \]
Sympy. Time used: 0.064 (sec). Leaf size: 19
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-x**3 - x + y(x) + Derivative(y(x), (x, 2)),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = C_{1} \sin {\left (x \right )} + C_{2} \cos {\left (x \right )} + x^{3} - 5 x \]