57.12.1 problem 1(a)

Internal problem ID [14444]
Book : A First Course in Differential Equations by J. David Logan. Third Edition. Springer-Verlag, NY. 2015.
Section : Chapter 2, Second order linear equations. Section 2.4.2 Variation of parameters. Exercises page 124
Problem number : 1(a)
Date solved : Thursday, October 02, 2025 at 09:37:21 AM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} x^{\prime \prime }+x&=\tan \left (t \right ) \end{align*}
Maple. Time used: 0.002 (sec). Leaf size: 23
ode:=diff(diff(x(t),t),t)+x(t) = tan(t); 
dsolve(ode,x(t), singsol=all);
 
\[ x = \sin \left (t \right ) c_2 +\cos \left (t \right ) c_1 -\cos \left (t \right ) \ln \left (\sec \left (t \right )+\tan \left (t \right )\right ) \]
Mathematica. Time used: 0.019 (sec). Leaf size: 23
ode=D[x[t],{t,2}]+x[t]==Tan[t]; 
ic={}; 
DSolve[{ode,ic},x[t],t,IncludeSingularSolutions->True]
 
\begin{align*} x(t)&\to \cos (t) (-\text {arctanh}(\sin (t)))+c_1 \cos (t)+c_2 \sin (t) \end{align*}
Sympy. Time used: 0.196 (sec). Leaf size: 29
from sympy import * 
t = symbols("t") 
x = Function("x") 
ode = Eq(x(t) - tan(t) + Derivative(x(t), (t, 2)),0) 
ics = {} 
dsolve(ode,func=x(t),ics=ics)
 
\[ x{\left (t \right )} = C_{2} \sin {\left (t \right )} + \left (C_{1} + \frac {\log {\left (\sin {\left (t \right )} - 1 \right )}}{2} - \frac {\log {\left (\sin {\left (t \right )} + 1 \right )}}{2}\right ) \cos {\left (t \right )} \]