80.1.6 problem 7

Internal problem ID [21124]
Book : A Textbook on Ordinary Differential Equations by Shair Ahmad and Antonio Ambrosetti. Second edition. ISBN 978-3-319-16407-6. Springer 2015
Section : Chapter 1. First order linear differential equations. Excercise 1.5 at page 13
Problem number : 7
Date solved : Thursday, October 02, 2025 at 07:09:22 PM
CAS classification : [_separable]

\begin{align*} x^{\prime }-2 x \cos \left (t \right )&=\cos \left (t \right ) \end{align*}

With initial conditions

\begin{align*} x \left (0\right )&={\frac {1}{2}} \\ \end{align*}
Maple. Time used: 0.008 (sec). Leaf size: 11
ode:=diff(x(t),t)-2*x(t)*cos(t) = cos(t); 
ic:=[x(0) = 1/2]; 
dsolve([ode,op(ic)],x(t), singsol=all);
 
\[ x = -\frac {1}{2}+{\mathrm e}^{2 \sin \left (t \right )} \]
Mathematica. Time used: 0.032 (sec). Leaf size: 15
ode=D[x[t],t]-2*Cos[t]*x[t]==Cos[t]; 
ic={x[0]==1/2}; 
DSolve[{ode,ic},x[t],t,IncludeSingularSolutions->True]
 
\begin{align*} x(t)&\to e^{2 \sin (t)}-\frac {1}{2} \end{align*}
Sympy. Time used: 0.221 (sec). Leaf size: 12
from sympy import * 
t = symbols("t") 
x = Function("x") 
ode = Eq(-2*x(t)*cos(t) - cos(t) + Derivative(x(t), t),0) 
ics = {x(0): 1/2} 
dsolve(ode,func=x(t),ics=ics)
 
\[ x{\left (t \right )} = e^{2 \sin {\left (t \right )}} - \frac {1}{2} \]