76.17.5 problem 14

Internal problem ID [17612]
Book : Differential equations. An introduction to modern methods and applications. James Brannan, William E. Boyce. Third edition. Wiley 2015
Section : Chapter 4. Second order linear equations. Section 4.7 (Variation of parameters). Problems at page 280
Problem number : 14
Date solved : Thursday, March 13, 2025 at 10:43:33 AM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y^{\prime \prime }+y&=\tan \left (t \right ) \end{align*}

Maple. Time used: 0.004 (sec). Leaf size: 23
ode:=diff(diff(y(t),t),t)+y(t) = tan(t); 
dsolve(ode,y(t), singsol=all);
 
\[ y = 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: 23
ode=D[y[t],{t,2}]+y[t]==Tan[t]; 
ic={}; 
DSolve[{ode,ic},y[t],t,IncludeSingularSolutions->True]
 
\[ y(t)\to \cos (t) (-\text {arctanh}(\sin (t)))+c_1 \cos (t)+c_2 \sin (t) \]
Sympy. Time used: 0.305 (sec). Leaf size: 29
from sympy import * 
t = symbols("t") 
y = Function("y") 
ode = Eq(y(t) - tan(t) + Derivative(y(t), (t, 2)),0) 
ics = {} 
dsolve(ode,func=y(t),ics=ics)
 
\[ y{\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 )} \]