2.2.3 problem 3

Internal problem ID [663]
Book : Differential equations and linear algebra, 3rd ed., Edwards and Penney
Section : Section 1.3. Slope fields and solution curves. Page 26
Problem number : 3
Date solved : Tuesday, September 30, 2025 at 04:05:08 AM
CAS classification : [[_linear, `class A`]]

\begin{align*} y^{\prime }&=-\sin \left (x \right )+y \end{align*}
Maple. Time used: 0.001 (sec). Leaf size: 17
ode:=diff(y(x),x) = -sin(x)+y(x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = \frac {\cos \left (x \right )}{2}+\frac {\sin \left (x \right )}{2}+{\mathrm e}^{x} c_1 \]
Mathematica. Time used: 0.02 (sec). Leaf size: 21
ode=D[y[x],x] == -Sin[x]+y[x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to \frac {1}{2} \left (\sin (x)+\cos (x)+2 c_1 e^x\right ) \end{align*}
Sympy. Time used: 0.075 (sec). Leaf size: 17
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-y(x) + sin(x) + Derivative(y(x), x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = C_{1} e^{x} + \frac {\sin {\left (x \right )}}{2} + \frac {\cos {\left (x \right )}}{2} \]