62.29.11 problem Ex 13

Internal problem ID [12883]
Book : An elementary treatise on differential equations by Abraham Cohen. DC heath publishers. 1906
Section : Chapter VII, Linear differential equations with constant coefficients. Article 52. Summary. Page 117
Problem number : Ex 13
Date solved : Wednesday, March 05, 2025 at 08:49:40 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

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

Maple. Time used: 0.003 (sec). Leaf size: 26
ode:=diff(diff(y(x),x),x)+y(x) = cos(x)*x; 
dsolve(ode,y(x), singsol=all);
 
\[ y = \frac {\left (x^{2}+4 c_{2} -1\right ) \sin \left (x \right )}{4}+\frac {\cos \left (x \right ) \left (4 c_{1} +x \right )}{4} \]
Mathematica. Time used: 0.069 (sec). Leaf size: 54
ode=D[y[x],{x,2}]+y[x]==x*Cos[x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \sin (x) \int _1^x\cos ^2(K[2]) K[2]dK[2]+\cos (x) \int _1^x-\cos (K[1]) K[1] \sin (K[1])dK[1]+c_1 \cos (x)+c_2 \sin (x) \]
Sympy. Time used: 0.127 (sec). Leaf size: 20
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-x*cos(x) + y(x) + Derivative(y(x), (x, 2)),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \left (C_{1} + \frac {x}{4}\right ) \cos {\left (x \right )} + \left (C_{2} + \frac {x^{2}}{4}\right ) \sin {\left (x \right )} \]