60.1.151 problem 154

Internal problem ID [10165]
Book : Differential Gleichungen, E. Kamke, 3rd ed. Chelsea Pub. NY, 1948
Section : Chapter 1, linear first order
Problem number : 154
Date solved : Sunday, March 30, 2025 at 03:21:05 PM
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.001 (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.039 (sec). Leaf size: 26
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 {\int _1^x\cos (K[1])dK[1]+c_1}{x^2-1} \]
Sympy. Time used: 0.336 (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} \]