20.9.10 problem Problem 10

Internal problem ID [3754]
Book : Differential equations and linear algebra, Stephen W. Goode and Scott A Annin. Fourth edition, 2015
Section : Chapter 8, Linear differential equations of order n. Section 8.7, The Variation of Parameters Method. page 556
Problem number : Problem 10
Date solved : Sunday, March 30, 2025 at 02:07:25 AM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y^{\prime \prime }+y&=\sec \left (x \right )+4 \,{\mathrm e}^{x} \end{align*}

Maple. Time used: 0.002 (sec). Leaf size: 25
ode:=diff(diff(y(x),x),x)+y(x) = sec(x)+4*exp(x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = \ln \left (\cos \left (x \right )\right ) \cos \left (x \right )+\cos \left (x \right ) c_1 +\left (x +c_2 \right ) \sin \left (x \right )+2 \,{\mathrm e}^{x} \]
Mathematica. Time used: 0.059 (sec). Leaf size: 91
ode=D[y[x],{x,2}]+y[x]==4*Exp[x]*Sec[x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to -4 i e^x \operatorname {Hypergeometric2F1}\left (-\frac {i}{2},1,1-\frac {i}{2},-e^{2 i x}\right ) \cos (x)+\left (\frac {8}{5}+\frac {4 i}{5}\right ) e^{(1+2 i) x} \operatorname {Hypergeometric2F1}\left (1,1-\frac {i}{2},2-\frac {i}{2},-e^{2 i x}\right ) \cos (x)+4 e^x \sin (x)+c_1 \cos (x)+c_2 \sin (x) \]
Sympy. Time used: 0.453 (sec). Leaf size: 24
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(y(x) - 4*exp(x) + Derivative(y(x), (x, 2)) - 1/cos(x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \left (C_{1} + x\right ) \sin {\left (x \right )} + \left (C_{2} + \log {\left (\cos {\left (x \right )} \right )}\right ) \cos {\left (x \right )} + 2 e^{x} \]