75.1.12 problem 14

Internal problem ID [16596]
Book : A book of problems in ordinary differential equations. M.L. KRASNOV, A.L. KISELYOV, G.I. MARKARENKO. MIR, MOSCOW. 1983
Section : Section 1. Basic concepts and definitions. Exercises page 18
Problem number : 14
Date solved : Thursday, March 13, 2025 at 08:25:30 AM
CAS classification : [_linear]

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

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