49.3.6 problem 2

Internal problem ID [7606]
Book : An introduction to Ordinary Differential Equations. Earl A. Coddington. Dover. NY 1961
Section : Chapter 1. Introduction– Linear equations of First Order. Page 45
Problem number : 2
Date solved : Wednesday, March 05, 2025 at 04:47:46 AM
CAS classification : [_linear]

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

With initial conditions

\begin{align*} y \left (\pi \right )&=\pi \end{align*}

Maple. Time used: 0.006 (sec). Leaf size: 11
ode:=diff(y(x),x)+cos(x)*y(x) = exp(-sin(x)); 
ic:=y(Pi) = Pi; 
dsolve([ode,ic],y(x), singsol=all);
 
\[ y = {\mathrm e}^{-\sin \left (x \right )} x \]
Mathematica. Time used: 0.138 (sec). Leaf size: 13
ode=D[y[x],x]+Cos[x]*y[x]==Exp[-Sin[x]]; 
ic={y[Pi]==Pi}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to x e^{-\sin (x)} \]
Sympy. Time used: 1.026 (sec). Leaf size: 8
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(y(x)*cos(x) + Derivative(y(x), x) - exp(-sin(x)),0) 
ics = {y(pi): pi} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = x e^{- \sin {\left (x \right )}} \]