2.4.17 problem 17

Internal problem ID [720]
Book : Differential equations and linear algebra, 3rd ed., Edwards and Penney
Section : Section 1.5. Linear first order equations. Page 56
Problem number : 17
Date solved : Tuesday, September 30, 2025 at 04:07:02 AM
CAS classification : [_linear]

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

With initial conditions

\begin{align*} y \left (0\right )&=1 \\ \end{align*}
Maple. Time used: 0.019 (sec). Leaf size: 14
ode:=y(x)+(1+x)*diff(y(x),x) = cos(x); 
ic:=[y(0) = 1]; 
dsolve([ode,op(ic)],y(x), singsol=all);
 
\[ y = \frac {\sin \left (x \right )+1}{1+x} \]
Mathematica. Time used: 0.021 (sec). Leaf size: 15
ode=y[x]+(1+x)*D[y[x],x] == Cos[x]; 
ic=y[0]==1; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to \frac {\sin (x)+1}{x+1} \end{align*}
Sympy. Time used: 0.162 (sec). Leaf size: 10
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq((x + 1)*Derivative(y(x), x) + y(x) - cos(x),0) 
ics = {y(0): 1} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \frac {\sin {\left (x \right )} + 1}{x + 1} \]