65.11.5 problem 18.1 (v)

Internal problem ID [13715]
Book : AN INTRODUCTION TO ORDINARY DIFFERENTIAL EQUATIONS by JAMES C. ROBINSON. Cambridge University Press 2004
Section : Chapter 18, The variation of constants formula. Exercises page 168
Problem number : 18.1 (v)
Date solved : Wednesday, March 05, 2025 at 10:13:35 PM
CAS classification : [[_2nd_order, _missing_y]]

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

Maple. Time used: 0.003 (sec). Leaf size: 24
ode:=diff(diff(x(t),t),t)-4*diff(x(t),t) = tan(t); 
dsolve(ode,x(t), singsol=all);
 
\[ x \left (t \right ) = \int \left (\int \tan \left (t \right ) {\mathrm e}^{-4 t}d t +c_{1} \right ) {\mathrm e}^{4 t}d t +c_{2} \]
Mathematica. Time used: 5.055 (sec). Leaf size: 43
ode=D[x[t],{t,2}]-4*D[x[t],t]==Tan[t]; 
ic={}; 
DSolve[{ode,ic},x[t],t,IncludeSingularSolutions->True]
 
\[ x(t)\to \int _1^te^{4 K[2]} \left (c_1+\int _1^{K[2]}e^{-4 K[1]} \tan (K[1])dK[1]\right )dK[2]+c_2 \]
Sympy. Time used: 0.620 (sec). Leaf size: 29
from sympy import * 
t = symbols("t") 
x = Function("x") 
ode = Eq(-tan(t) - 4*Derivative(x(t), t) + Derivative(x(t), (t, 2)),0) 
ics = {} 
dsolve(ode,func=x(t),ics=ics)
 
\[ x{\left (t \right )} = C_{1} + \left (C_{2} + \frac {\int e^{- 4 t} \tan {\left (t \right )}\, dt}{4}\right ) e^{4 t} + \frac {\log {\left (\cos {\left (t \right )} \right )}}{4} \]