66.1.45 problem Problem 59

Internal problem ID [13821]
Book : Differential equations and the calculus of variations by L. ElSGOLTS. MIR PUBLISHERS, MOSCOW, Third printing 1977.
Section : Chapter 1, First-Order Differential Equations. Problems page 88
Problem number : Problem 59
Date solved : Monday, March 31, 2025 at 08:14:08 AM
CAS classification : [_linear]

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

Maple. Time used: 0.002 (sec). Leaf size: 16
ode:=(x^2-1)*diff(y(x),x)+2*x*y(x)-cos(x) = 0; 
dsolve(ode,y(x), singsol=all);
 
\[ y = \frac {\sin \left (x \right )+c_1}{x^{2}-1} \]
Mathematica. Time used: 0.051 (sec). Leaf size: 18
ode=(x^2-1)*D[y[x],x]+2*x*y[x]-Cos[x]==0; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \frac {\sin (x)+c_1}{x^2-1} \]
Sympy. Time used: 0.334 (sec). Leaf size: 12
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(2*x*y(x) + (x**2 - 1)*Derivative(y(x), x) - cos(x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \frac {C_{1} + \sin {\left (x \right )}}{x^{2} - 1} \]