63.12.1 problem 1(a)

Internal problem ID [13084]
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 : Wednesday, March 05, 2025 at 09:16:55 PM
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 \left (t \right ) = c_{2} \sin \left (t \right )+\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.03 (sec). Leaf size: 41
ode=D[x[t],{t,2}]+x[t]==Tan[t]; 
ic={}; 
DSolve[{ode,ic},x[t],t,IncludeSingularSolutions->True]
 
\[ x(t)\to \sin (t) \int _1^t\sin (K[1])dK[1]+\cos (t) (-\text {arctanh}(\sin (t)))+\sin (t) \cos (t)+c_1 \cos (t)+c_2 \sin (t) \]
Sympy. Time used: 0.307 (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 )} \]