83.17.1 problem 1

Internal problem ID [19126]
Book : A Text book for differentional equations for postgraduate students by Ray and Chaturvedi. First edition, 1958. BHASKAR press. INDIA
Section : Chapter III. Ordinary linear differential equations with constant coefficients. Misc. Examples on chapter III at page 50
Problem number : 1
Date solved : Monday, March 31, 2025 at 06:49:06 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y^{\prime \prime }+2 y^{\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)+2*diff(y(x),x)+y(x) = x*cos(x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = \left (c_1 x +c_2 \right ) {\mathrm e}^{-x}+\frac {\left (x -1\right ) \sin \left (x \right )}{2}+\frac {\cos \left (x \right )}{2} \]
Mathematica. Time used: 0.02 (sec). Leaf size: 32
ode=D[y[x],{x,2}]+2*D[y[x],x]+y[x]==x*Cos[x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \frac {1}{2} \left ((x-1) \sin (x)+\cos (x)+2 e^{-x} (c_2 x+c_1)\right ) \]
Sympy. Time used: 0.233 (sec). Leaf size: 27
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-x*cos(x) + y(x) + 2*Derivative(y(x), x) + Derivative(y(x), (x, 2)),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \frac {x \sin {\left (x \right )}}{2} + \left (C_{1} + C_{2} x\right ) e^{- x} - \frac {\sin {\left (x \right )}}{2} + \frac {\cos {\left (x \right )}}{2} \]