64.11.51 problem 51

Internal problem ID [13430]
Book : Differential Equations by Shepley L. Ross. Third edition. John Willey. New Delhi. 2004.
Section : Chapter 4, Section 4.3. The method of undetermined coefficients. Exercises page 151
Problem number : 51
Date solved : Monday, March 31, 2025 at 07:57:37 AM
CAS classification : [[_high_order, _linear, _nonhomogeneous]]

\begin{align*} y^{\prime \prime \prime \prime }+2 y^{\prime \prime }+y&=x^{2} \cos \left (x \right ) \end{align*}

Maple. Time used: 0.005 (sec). Leaf size: 46
ode:=diff(diff(diff(diff(y(x),x),x),x),x)+2*diff(diff(y(x),x),x)+y(x) = x^2*cos(x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = \frac {\left (-4 x^{4}+192 c_3 x +36 x^{2}+192 c_1 -21\right ) \cos \left (x \right )}{192}+\frac {\sin \left (x \right ) \left (x^{3}+\left (12 c_4 -3\right ) x +12 c_2 \right )}{12} \]
Mathematica. Time used: 0.216 (sec). Leaf size: 140
ode=D[y[x],{x,4}]+2*D[y[x],{x,2}]+y[x]==x^2*Cos[x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to x \sin (x) \int _1^x-\frac {1}{4} K[4]^2 \sin (2 K[4])dK[4]+x \cos (x) \int _1^x-\frac {1}{2} \cos ^2(K[2]) K[2]^2dK[2]+\cos (x) \int _1^x\frac {1}{2} \cos (K[1]) K[1]^2 (\cos (K[1]) K[1]-\sin (K[1]))dK[1]+\sin (x) \int _1^x\frac {1}{2} \cos (K[3]) K[3]^2 (\cos (K[3])+K[3] \sin (K[3]))dK[3]+c_1 \cos (x)+c_2 x \cos (x)+c_3 \sin (x)+c_4 x \sin (x) \]
Sympy. Time used: 0.264 (sec). Leaf size: 34
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-x**2*cos(x) + y(x) + 2*Derivative(y(x), (x, 2)) + Derivative(y(x), (x, 4)),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \left (C_{1} + x \left (C_{2} + \frac {x^{2}}{12}\right )\right ) \sin {\left (x \right )} + \left (C_{3} + x \left (C_{4} - \frac {x^{3}}{48} + \frac {3 x}{16}\right )\right ) \cos {\left (x \right )} \]