2.33 problem 33
Internal
problem
ID
[8122]
Book
:
Second
order
enumerated
odes
Section
:
section
2
Problem
number
:
33
Date
solved
:
Monday, October 21, 2024 at 04:53:48 PM
CAS
classification
:
[[_2nd_order, _linear, _nonhomogeneous]]
Solve
\begin{align*} y^{\prime \prime }-2 \tan \left (x \right ) y^{\prime }+5 y&={\mathrm e}^{x^{2}} \sec \left (x \right ) \end{align*}
2.33.1 Solved as second order ode using change of variable on y method 1
Time used: 0.754 (sec)
This is second order non-homogeneous ODE. Let the solution be
\[
y = y_h + y_p
\]
Where \(y_h\) is the solution to
the homogeneous ODE \( A y''(x) + B y'(x) + C y(x) = 0\), and \(y_p\) is a particular solution to the non-homogeneous ODE \(A y''(x) + B y'(x) + C y(x) = f(x)\). \(y_h\) is the
solution to
\[
y^{\prime \prime }-2 \tan \left (x \right ) y^{\prime }+5 y = 0
\]
In normal form the given ode is written as
\begin{align*} y^{\prime \prime }+p \left (x \right ) y^{\prime }+q \left (x \right ) y&=0 \tag {2} \end{align*}
Where
\begin{align*} p \left (x \right )&=-2 \tan \left (x \right )\\ q \left (x \right )&=5 \end{align*}
Calculating the Liouville ode invariant \(Q\) given by
\begin{align*} Q &= q - \frac {p'}{2}- \frac {p^2}{4} \\ &= 5 - \frac {\left (-2 \tan \left (x \right )\right )'}{2}- \frac {\left (-2 \tan \left (x \right )\right )^2}{4} \\ &= 5 - \frac {\left (-2-2 \tan \left (x \right )^{2}\right )}{2}- \frac {\left (4 \tan \left (x \right )^{2}\right )}{4} \\ &= 5 - \left (-1-\tan \left (x \right )^{2}\right )-\tan \left (x \right )^{2}\\ &= 6 \end{align*}
Since the Liouville ode invariant does not depend on the independent variable \(x\) then the
transformation
\begin{align*} y = v \left (x \right ) z \left (x \right )\tag {3} \end{align*}
is used to change the original ode to a constant coefficients ode in \(v\). In (3) the term \(z \left (x \right )\) is given
by
\begin{align*} z \left (x \right )&={\mathrm e}^{-\left (\int \frac {p \left (x \right )}{2}d x \right )}\\ &= e^{-\int \frac {-2 \tan \left (x \right )}{2} }\\ &= \sec \left (x \right )\tag {5} \end{align*}
Hence (3) becomes
\begin{align*} y = v \left (x \right ) \sec \left (x \right )\tag {4} \end{align*}
Applying this change of variable to the original ode results in
\begin{align*} \sec \left (x \right ) \left (v^{\prime \prime }\left (x \right )+6 v \left (x \right )\right ) = 0 \end{align*}
Which is now solved for \(v \left (x \right )\).
The above ode can be simplified to
\begin{align*} v^{\prime \prime }\left (x \right )+6 v \left (x \right ) = 0 \end{align*}
This is second order with constant coefficients homogeneous ODE. In standard form the
ODE is
\[ A v''(x) + B v'(x) + C v(x) = 0 \]
Where in the above \(A=1, B=0, C=6\). Let the solution be \(v \left (x \right )=e^{\lambda x}\). Substituting this into the ODE gives
\[ \lambda ^{2} {\mathrm e}^{x \lambda }+6 \,{\mathrm e}^{x \lambda } = 0 \tag {1} \]
Since exponential function is never zero, then dividing Eq(2) throughout by \(e^{\lambda x}\) gives
\[ \lambda ^{2}+6 = 0 \tag {2} \]
Equation (2) is the characteristic equation of the ODE. Its roots determine the
general solution form.Using the quadratic formula
\[ \lambda _{1,2} = \frac {-B}{2 A} \pm \frac {1}{2 A} \sqrt {B^2 - 4 A C} \]
Substituting \(A=1, B=0, C=6\) into the above gives
\begin{align*} \lambda _{1,2} &= \frac {0}{(2) \left (1\right )} \pm \frac {1}{(2) \left (1\right )} \sqrt {0^2 - (4) \left (1\right )\left (6\right )}\\ &= \pm i \sqrt {6} \end{align*}
Hence
\begin{align*} \lambda _1 &= + i \sqrt {6}\\ \lambda _2 &= - i \sqrt {6} \end{align*}
Which simplifies to
\begin{align*}
\lambda _1 &= i \sqrt {6} \\
\lambda _2 &= -i \sqrt {6} \\
\end{align*}
Since roots are complex conjugate of each others, then let the
roots be
\[
\lambda _{1,2} = \alpha \pm i \beta
\]
Where \(\alpha =0\) and \(\beta =\sqrt {6}\). Therefore the final solution, when using Euler relation,
can be written as
\[
v \left (x \right ) = e^{\alpha x} \left ( c_1 \cos (\beta x) + c_2 \sin (\beta x) \right )
\]
Which becomes
\[
v \left (x \right ) = e^{0}\left (c_1 \cos \left (\sqrt {6}\, x \right )+c_2 \sin \left (\sqrt {6}\, x \right )\right )
\]
Or
\[
v \left (x \right ) = c_1 \cos \left (\sqrt {6}\, x \right )+c_2 \sin \left (\sqrt {6}\, x \right )
\]
Will add steps showing solving for IC
soon.
Now that \(v \left (x \right )\) is known, then
\begin{align*} y&= v \left (x \right ) z \left (x \right )\\ &= \left (c_1 \cos \left (\sqrt {6}\, x \right )+c_2 \sin \left (\sqrt {6}\, x \right )\right ) \left (z \left (x \right )\right )\tag {7} \end{align*}
But from (5)
\begin{align*} z \left (x \right )&= \sec \left (x \right ) \end{align*}
Hence (7) becomes
\begin{align*} y = \left (c_1 \cos \left (\sqrt {6}\, x \right )+c_2 \sin \left (\sqrt {6}\, x \right )\right ) \sec \left (x \right ) \end{align*}
Therefore the homogeneous solution \(y_h\) is
\[
y_h = \left (c_1 \cos \left (\sqrt {6}\, x \right )+c_2 \sin \left (\sqrt {6}\, x \right )\right ) \sec \left (x \right )
\]
The particular solution \(y_p\) can be found
using either the method of undetermined coefficients, or the method of variation
of parameters. The method of variation of parameters will be used as it is more
general and can be used when the coefficients of the ODE depend on \(x\) as well.
Let
\begin{equation}
\tag{1} y_p(x) = u_1 y_1 + u_2 y_2
\end{equation}
Where \(u_1,u_2\) to be determined, and \(y_1,y_2\) are the two basis solutions (the two linearly
independent solutions of the homogeneous ODE) found earlier when solving the
homogeneous ODE as
\begin{align*}
y_1 &= \cos \left (\sqrt {6}\, x \right ) \sec \left (x \right ) \\
y_2 &= \sin \left (\sqrt {6}\, x \right ) \sec \left (x \right ) \\
\end{align*}
In the Variation of parameters \(u_1,u_2\) are found using
\begin{align*}
\tag{2} u_1 &= -\int \frac {y_2 f(x)}{a W(x)} \\
\tag{3} u_2 &= \int \frac {y_1 f(x)}{a W(x)} \\
\end{align*}
Where \(W(x)\) is the
Wronskian and \(a\) is the coefficient in front of \(y''\) in the given ODE. The Wronskian is given
by \(W= \begin {vmatrix} y_1 & y_{2} \\ y_{1}^{\prime } & y_{2}^{\prime } \end {vmatrix} \). Hence
\[ W = \begin {vmatrix} \cos \left (\sqrt {6}\, x \right ) \sec \left (x \right ) & \sin \left (\sqrt {6}\, x \right ) \sec \left (x \right ) \\ \frac {d}{dx}\left (\cos \left (\sqrt {6}\, x \right ) \sec \left (x \right )\right ) & \frac {d}{dx}\left (\sin \left (\sqrt {6}\, x \right ) \sec \left (x \right )\right ) \end {vmatrix} \]
Which gives
\[ W = \begin {vmatrix} \cos \left (\sqrt {6}\, x \right ) \sec \left (x \right ) & \sin \left (\sqrt {6}\, x \right ) \sec \left (x \right ) \\ -\sqrt {6}\, \sin \left (\sqrt {6}\, x \right ) \sec \left (x \right )+\cos \left (\sqrt {6}\, x \right ) \sec \left (x \right ) \tan \left (x \right ) & \sqrt {6}\, \cos \left (\sqrt {6}\, x \right ) \sec \left (x \right )+\sin \left (\sqrt {6}\, x \right ) \sec \left (x \right ) \tan \left (x \right ) \end {vmatrix} \]
Therefore
\[
W = \left (\cos \left (\sqrt {6}\, x \right ) \sec \left (x \right )\right )\left (\sqrt {6}\, \cos \left (\sqrt {6}\, x \right ) \sec \left (x \right )+\sin \left (\sqrt {6}\, x \right ) \sec \left (x \right ) \tan \left (x \right )\right ) - \left (\sin \left (\sqrt {6}\, x \right ) \sec \left (x \right )\right )\left (-\sqrt {6}\, \sin \left (\sqrt {6}\, x \right ) \sec \left (x \right )+\cos \left (\sqrt {6}\, x \right ) \sec \left (x \right ) \tan \left (x \right )\right )
\]
Which simplifies to
\[
W = \cos \left (\sqrt {6}\, x \right )^{2} \sec \left (x \right )^{2} \sqrt {6}+\sin \left (\sqrt {6}\, x \right )^{2} \sec \left (x \right )^{2} \sqrt {6}
\]
Which simplifies to
\[
W = \sqrt {6}\, \sec \left (x \right )^{2}
\]
Therefore Eq. (2) becomes
\[
u_1 = -\int \frac {\sin \left (\sqrt {6}\, x \right ) \sec \left (x \right )^{2} {\mathrm e}^{x^{2}}}{\sqrt {6}\, \sec \left (x \right )^{2}}\,dx
\]
Which simplifies to
\[
u_1 = - \int \frac {\sin \left (\sqrt {6}\, x \right ) {\mathrm e}^{x^{2}} \sqrt {6}}{6}d x
\]
Hence
\[
u_1 = \frac {\sqrt {6}\, \sqrt {\pi }\, {\mathrm e}^{\frac {3}{2}} \operatorname {erf}\left (i x -\frac {\sqrt {6}}{2}\right )}{24}-\frac {\sqrt {6}\, \sqrt {\pi }\, {\mathrm e}^{\frac {3}{2}} \operatorname {erf}\left (i x +\frac {\sqrt {6}}{2}\right )}{24}
\]
And Eq. (3) becomes
\[
u_2 = \int \frac {\cos \left (\sqrt {6}\, x \right ) \sec \left (x \right )^{2} {\mathrm e}^{x^{2}}}{\sqrt {6}\, \sec \left (x \right )^{2}}\,dx
\]
Which
simplifies to
\[
u_2 = \int \frac {\cos \left (\sqrt {6}\, x \right ) {\mathrm e}^{x^{2}} \sqrt {6}}{6}d x
\]
Hence
\[
u_2 = -\frac {i \sqrt {6}\, \sqrt {\pi }\, {\mathrm e}^{\frac {3}{2}} \operatorname {erf}\left (i x +\frac {\sqrt {6}}{2}\right )}{24}-\frac {i \sqrt {6}\, \sqrt {\pi }\, {\mathrm e}^{\frac {3}{2}} \operatorname {erf}\left (i x -\frac {\sqrt {6}}{2}\right )}{24}
\]
Therefore the particular solution, from equation (1) is
\[
y_p(x) = \left (\frac {\sqrt {6}\, \sqrt {\pi }\, {\mathrm e}^{\frac {3}{2}} \operatorname {erf}\left (i x -\frac {\sqrt {6}}{2}\right )}{24}-\frac {\sqrt {6}\, \sqrt {\pi }\, {\mathrm e}^{\frac {3}{2}} \operatorname {erf}\left (i x +\frac {\sqrt {6}}{2}\right )}{24}\right ) \cos \left (\sqrt {6}\, x \right ) \sec \left (x \right )+\sin \left (\sqrt {6}\, x \right ) \sec \left (x \right ) \left (-\frac {i \sqrt {6}\, \sqrt {\pi }\, {\mathrm e}^{\frac {3}{2}} \operatorname {erf}\left (i x +\frac {\sqrt {6}}{2}\right )}{24}-\frac {i \sqrt {6}\, \sqrt {\pi }\, {\mathrm e}^{\frac {3}{2}} \operatorname {erf}\left (i x -\frac {\sqrt {6}}{2}\right )}{24}\right )
\]
Which
simplifies to
\[
y_p(x) = -\frac {{\mathrm e}^{\frac {3}{2}} \sqrt {\pi }\, \sqrt {6}\, \sec \left (x \right ) \left (\left (i \sin \left (\sqrt {6}\, x \right )-\cos \left (\sqrt {6}\, x \right )\right ) \operatorname {erf}\left (i x -\frac {\sqrt {6}}{2}\right )+\operatorname {erf}\left (i x +\frac {\sqrt {6}}{2}\right ) \left (i \sin \left (\sqrt {6}\, x \right )+\cos \left (\sqrt {6}\, x \right )\right )\right )}{24}
\]
Therefore the general solution is
\begin{align*}
y &= y_h + y_p \\
&= \left (\left (c_1 \cos \left (\sqrt {6}\, x \right )+c_2 \sin \left (\sqrt {6}\, x \right )\right ) \sec \left (x \right )\right ) + \left (-\frac {{\mathrm e}^{\frac {3}{2}} \sqrt {\pi }\, \sqrt {6}\, \sec \left (x \right ) \left (\left (i \sin \left (\sqrt {6}\, x \right )-\cos \left (\sqrt {6}\, x \right )\right ) \operatorname {erf}\left (i x -\frac {\sqrt {6}}{2}\right )+\operatorname {erf}\left (i x +\frac {\sqrt {6}}{2}\right ) \left (i \sin \left (\sqrt {6}\, x \right )+\cos \left (\sqrt {6}\, x \right )\right )\right )}{24}\right ) \\
\end{align*}
Will add steps showing solving for IC
soon.
2.33.2 Solved as second order ode using Kovacic algorithm
Time used: 0.344 (sec)
Writing the ode as
\begin{align*} y^{\prime \prime }-2 \tan \left (x \right ) y^{\prime }+5 y &= 0 \tag {1} \\ A y^{\prime \prime } + B y^{\prime } + C y &= 0 \tag {2} \end{align*}
Comparing (1) and (2) shows that
\begin{align*} A &= 1 \\ B &= -2 \tan \left (x \right )\tag {3} \\ C &= 5 \end{align*}
Applying the Liouville transformation on the dependent variable gives
\begin{align*} z(x) &= y e^{\int \frac {B}{2 A} \,dx} \end{align*}
Then (2) becomes
\begin{align*} z''(x) = r z(x)\tag {4} \end{align*}
Where \(r\) is given by
\begin{align*} r &= \frac {s}{t}\tag {5} \\ &= \frac {2 A B' - 2 B A' + B^2 - 4 A C}{4 A^2} \end{align*}
Substituting the values of \(A,B,C\) from (3) in the above and simplifying gives
\begin{align*} r &= \frac {-6}{1}\tag {6} \end{align*}
Comparing the above to (5) shows that
\begin{align*} s &= -6\\ t &= 1 \end{align*}
Therefore eq. (4) becomes
\begin{align*} z''(x) &= -6 z \left (x \right ) \tag {7} \end{align*}
Equation (7) is now solved. After finding \(z(x)\) then \(y\) is found using the inverse transformation
\begin{align*} y &= z \left (x \right ) e^{-\int \frac {B}{2 A} \,dx} \end{align*}
The first step is to determine the case of Kovacic algorithm this ode belongs to. There are 3
cases depending on the order of poles of \(r\) and the order of \(r\) at \(\infty \). The following table
summarizes these cases.
| | |
Case |
Allowed pole order for \(r\) |
Allowed value for \(\mathcal {O}(\infty )\) |
| | |
1 |
\(\left \{ 0,1,2,4,6,8,\cdots \right \} \) |
\(\left \{ \cdots ,-6,-4,-2,0,2,3,4,5,6,\cdots \right \} \) |
| | |
2
|
Need to have at least one pole
that is either order \(2\) or odd order
greater than \(2\). Any other pole order
is allowed as long as the above
condition is satisfied. Hence the
following set of pole orders are all
allowed. \(\{1,2\}\),\(\{1,3\}\),\(\{2\}\),\(\{3\}\),\(\{3,4\}\),\(\{1,2,5\}\). |
no condition |
| | |
3 |
\(\left \{ 1,2\right \} \) |
\(\left \{ 2,3,4,5,6,7,\cdots \right \} \) |
| | |
Table 45: Necessary conditions for each Kovacic case
The order of \(r\) at \(\infty \) is the degree of \(t\) minus the degree of \(s\). Therefore
\begin{align*} O\left (\infty \right ) &= \text {deg}(t) - \text {deg}(s) \\ &= 0 - 0 \\ &= 0 \end{align*}
There are no poles in \(r\). Therefore the set of poles \(\Gamma \) is empty. Since there is no odd order pole
larger than \(2\) and the order at \(\infty \) is \(0\) then the necessary conditions for case one are met.
Therefore
\begin{align*} L &= [1] \end{align*}
Since \(r = -6\) is not a function of \(x\), then there is no need run Kovacic algorithm to obtain a solution
for transformed ode \(z''=r z\) as one solution is
\[ z_1(x) = \cos \left (\sqrt {6}\, x \right ) \]
Using the above, the solution for the original ode can
now be found. The first solution to the original ode in \(y\) is found from
\begin{align*}
y_1 &= z_1 e^{ \int -\frac {1}{2} \frac {B}{A} \,dx} \\
&= z_1 e^{ -\int \frac {1}{2} \frac {-2 \tan \left (x \right )}{1} \,dx} \\
&= z_1 e^{-\ln \left (\cos \left (x \right )\right )} \\
&= z_1 \left (\sec \left (x \right )\right ) \\
\end{align*}
Which simplifies to
\[
y_1 = \cos \left (\sqrt {6}\, x \right ) \sec \left (x \right )
\]
The second solution \(y_2\) to the original ode is found using reduction of order
\[ y_2 = y_1 \int \frac { e^{\int -\frac {B}{A} \,dx}}{y_1^2} \,dx \]
Substituting gives
\begin{align*}
y_2 &= y_1 \int \frac { e^{\int -\frac {-2 \tan \left (x \right )}{1} \,dx}}{\left (y_1\right )^2} \,dx \\
&= y_1 \int \frac { e^{-2 \ln \left (\cos \left (x \right )\right )}}{\left (y_1\right )^2} \,dx \\
&= y_1 \left (\frac {\sqrt {6}\, \tan \left (\sqrt {6}\, x \right )}{6}\right ) \\
\end{align*}
Therefore the solution is
\begin{align*}
y &= c_1 y_1 + c_2 y_2 \\
&= c_1 \left (\cos \left (\sqrt {6}\, x \right ) \sec \left (x \right )\right ) + c_2 \left (\cos \left (\sqrt {6}\, x \right ) \sec \left (x \right )\left (\frac {\sqrt {6}\, \tan \left (\sqrt {6}\, x \right )}{6}\right )\right ) \\
\end{align*}
This is second order nonhomogeneous ODE. Let the solution be
\[
y = y_h + y_p
\]
Where \(y_h\) is the solution to
the homogeneous ODE \( A y''(x) + B y'(x) + C y(x) = 0\), and \(y_p\) is a particular solution to the nonhomogeneous ODE \(A y''(x) + B y'(x) + C y(x) = f(x)\). \(y_h\) is the
solution to
\[
y^{\prime \prime }-2 \tan \left (x \right ) y^{\prime }+5 y = 0
\]
The homogeneous solution is found using the Kovacic algorithm which results in
\[
y_h = c_1 \cos \left (\sqrt {6}\, x \right ) \sec \left (x \right )+\frac {c_2 \sqrt {6}\, \sin \left (\sqrt {6}\, x \right ) \sec \left (x \right )}{6}
\]
The particular solution \(y_p\) can be found using either the method of undetermined coefficients,
or the method of variation of parameters. The method of variation of parameters will be
used as it is more general and can be used when the coefficients of the ODE depend on \(x\) as
well. Let
\begin{equation}
\tag{1} y_p(x) = u_1 y_1 + u_2 y_2
\end{equation}
Where \(u_1,u_2\) to be determined, and \(y_1,y_2\) are the two basis solutions (the two linearly
independent solutions of the homogeneous ODE) found earlier when solving the
homogeneous ODE as
\begin{align*}
y_1 &= \cos \left (\sqrt {6}\, x \right ) \sec \left (x \right ) \\
y_2 &= \frac {\sqrt {6}\, \sin \left (\sqrt {6}\, x \right ) \sec \left (x \right )}{6} \\
\end{align*}
In the Variation of parameters \(u_1,u_2\) are found using
\begin{align*}
\tag{2} u_1 &= -\int \frac {y_2 f(x)}{a W(x)} \\
\tag{3} u_2 &= \int \frac {y_1 f(x)}{a W(x)} \\
\end{align*}
Where \(W(x)\) is the
Wronskian and \(a\) is the coefficient in front of \(y''\) in the given ODE. The Wronskian is given
by \(W= \begin {vmatrix} y_1 & y_{2} \\ y_{1}^{\prime } & y_{2}^{\prime } \end {vmatrix} \). Hence
\[ W = \begin {vmatrix} \cos \left (\sqrt {6}\, x \right ) \sec \left (x \right ) & \frac {\sqrt {6}\, \sin \left (\sqrt {6}\, x \right ) \sec \left (x \right )}{6} \\ \frac {d}{dx}\left (\cos \left (\sqrt {6}\, x \right ) \sec \left (x \right )\right ) & \frac {d}{dx}\left (\frac {\sqrt {6}\, \sin \left (\sqrt {6}\, x \right ) \sec \left (x \right )}{6}\right ) \end {vmatrix} \]
Which gives
\[ W = \begin {vmatrix} \cos \left (\sqrt {6}\, x \right ) \sec \left (x \right ) & \frac {\sqrt {6}\, \sin \left (\sqrt {6}\, x \right ) \sec \left (x \right )}{6} \\ -\sqrt {6}\, \sin \left (\sqrt {6}\, x \right ) \sec \left (x \right )+\cos \left (\sqrt {6}\, x \right ) \sec \left (x \right ) \tan \left (x \right ) & \cos \left (\sqrt {6}\, x \right ) \sec \left (x \right )+\frac {\sqrt {6}\, \sin \left (\sqrt {6}\, x \right ) \sec \left (x \right ) \tan \left (x \right )}{6} \end {vmatrix} \]
Therefore
\[
W = \left (\cos \left (\sqrt {6}\, x \right ) \sec \left (x \right )\right )\left (\cos \left (\sqrt {6}\, x \right ) \sec \left (x \right )+\frac {\sqrt {6}\, \sin \left (\sqrt {6}\, x \right ) \sec \left (x \right ) \tan \left (x \right )}{6}\right ) - \left (\frac {\sqrt {6}\, \sin \left (\sqrt {6}\, x \right ) \sec \left (x \right )}{6}\right )\left (-\sqrt {6}\, \sin \left (\sqrt {6}\, x \right ) \sec \left (x \right )+\cos \left (\sqrt {6}\, x \right ) \sec \left (x \right ) \tan \left (x \right )\right )
\]
Which simplifies to
\[
W = \cos \left (\sqrt {6}\, x \right )^{2} \sec \left (x \right )^{2}+\sec \left (x \right )^{2} \sin \left (\sqrt {6}\, x \right )^{2}
\]
Which simplifies to
\[
W = \sec \left (x \right )^{2}
\]
Therefore Eq. (2) becomes
\[
u_1 = -\int \frac {\frac {\sqrt {6}\, \sin \left (\sqrt {6}\, x \right ) \sec \left (x \right )^{2} {\mathrm e}^{x^{2}}}{6}}{\sec \left (x \right )^{2}}\,dx
\]
Which simplifies to
\[
u_1 = - \int \frac {\sin \left (\sqrt {6}\, x \right ) {\mathrm e}^{x^{2}} \sqrt {6}}{6}d x
\]
Hence
\[
u_1 = \frac {\sqrt {6}\, \sqrt {\pi }\, {\mathrm e}^{\frac {3}{2}} \operatorname {erf}\left (i x -\frac {\sqrt {6}}{2}\right )}{24}-\frac {\sqrt {6}\, \sqrt {\pi }\, {\mathrm e}^{\frac {3}{2}} \operatorname {erf}\left (i x +\frac {\sqrt {6}}{2}\right )}{24}
\]
And Eq. (3) becomes
\[
u_2 = \int \frac {\cos \left (\sqrt {6}\, x \right ) \sec \left (x \right )^{2} {\mathrm e}^{x^{2}}}{\sec \left (x \right )^{2}}\,dx
\]
Which
simplifies to
\[
u_2 = \int \cos \left (\sqrt {6}\, x \right ) {\mathrm e}^{x^{2}}d x
\]
Hence
\[
u_2 = -\frac {i \sqrt {\pi }\, {\mathrm e}^{\frac {3}{2}} \operatorname {erf}\left (i x +\frac {\sqrt {6}}{2}\right )}{4}-\frac {i \sqrt {\pi }\, {\mathrm e}^{\frac {3}{2}} \operatorname {erf}\left (i x -\frac {\sqrt {6}}{2}\right )}{4}
\]
Therefore the particular solution, from equation (1) is
\[
y_p(x) = \left (\frac {\sqrt {6}\, \sqrt {\pi }\, {\mathrm e}^{\frac {3}{2}} \operatorname {erf}\left (i x -\frac {\sqrt {6}}{2}\right )}{24}-\frac {\sqrt {6}\, \sqrt {\pi }\, {\mathrm e}^{\frac {3}{2}} \operatorname {erf}\left (i x +\frac {\sqrt {6}}{2}\right )}{24}\right ) \cos \left (\sqrt {6}\, x \right ) \sec \left (x \right )+\frac {\sqrt {6}\, \sin \left (\sqrt {6}\, x \right ) \sec \left (x \right ) \left (-\frac {i \sqrt {\pi }\, {\mathrm e}^{\frac {3}{2}} \operatorname {erf}\left (i x +\frac {\sqrt {6}}{2}\right )}{4}-\frac {i \sqrt {\pi }\, {\mathrm e}^{\frac {3}{2}} \operatorname {erf}\left (i x -\frac {\sqrt {6}}{2}\right )}{4}\right )}{6}
\]
Which
simplifies to
\[
y_p(x) = -\frac {{\mathrm e}^{\frac {3}{2}} \sqrt {\pi }\, \sqrt {6}\, \sec \left (x \right ) \left (\left (i \sin \left (\sqrt {6}\, x \right )-\cos \left (\sqrt {6}\, x \right )\right ) \operatorname {erf}\left (i x -\frac {\sqrt {6}}{2}\right )+\operatorname {erf}\left (i x +\frac {\sqrt {6}}{2}\right ) \left (i \sin \left (\sqrt {6}\, x \right )+\cos \left (\sqrt {6}\, x \right )\right )\right )}{24}
\]
Therefore the general solution is
\begin{align*}
y &= y_h + y_p \\
&= \left (c_1 \cos \left (\sqrt {6}\, x \right ) \sec \left (x \right )+\frac {c_2 \sqrt {6}\, \sin \left (\sqrt {6}\, x \right ) \sec \left (x \right )}{6}\right ) + \left (-\frac {{\mathrm e}^{\frac {3}{2}} \sqrt {\pi }\, \sqrt {6}\, \sec \left (x \right ) \left (\left (i \sin \left (\sqrt {6}\, x \right )-\cos \left (\sqrt {6}\, x \right )\right ) \operatorname {erf}\left (i x -\frac {\sqrt {6}}{2}\right )+\operatorname {erf}\left (i x +\frac {\sqrt {6}}{2}\right ) \left (i \sin \left (\sqrt {6}\, x \right )+\cos \left (\sqrt {6}\, x \right )\right )\right )}{24}\right ) \\
\end{align*}
Will add steps showing solving for IC
soon.
2.33.3 Solved as second order ode adjoint method
Time used: 4.222 (sec)
In normal form the ode
\begin{align*} y^{\prime \prime }-2 \tan \left (x \right ) y^{\prime }+5 y = {\mathrm e}^{x^{2}} \sec \left (x \right ) \tag {1} \end{align*}
Becomes
\begin{align*} y^{\prime \prime }+p \left (x \right ) y^{\prime }+q \left (x \right ) y&=r \left (x \right ) \tag {2} \end{align*}
Where
\begin{align*} p \left (x \right )&=-2 \tan \left (x \right )\\ q \left (x \right )&=5\\ r \left (x \right )&={\mathrm e}^{x^{2}} \sec \left (x \right ) \end{align*}
The Lagrange adjoint ode is given by
\begin{align*} \xi ^{''}-(\xi \, p)'+\xi q &= 0\\ \xi ^{''}-\left (-2 \tan \left (x \right ) \xi \left (x \right )\right )' + \left (5 \xi \left (x \right )\right ) &= 0\\ 2 \tan \left (x \right ) \xi ^{\prime }\left (x \right )+5 \xi \left (x \right )+\xi ^{\prime \prime }\left (x \right )+2 \sec \left (x \right )^{2} \xi \left (x \right )&= 0 \end{align*}
Which is solved for \(\xi (x)\). In normal form the given ode is written as
\begin{align*} \xi ^{\prime \prime }+p \left (x \right ) \xi ^{\prime }+q \left (x \right ) \xi &=0 \tag {2} \end{align*}
Where
\begin{align*} p \left (x \right )&=2 \tan \left (x \right )\\ q \left (x \right )&=5+2 \sec \left (x \right )^{2} \end{align*}
Calculating the Liouville ode invariant \(Q\) given by
\begin{align*} Q &= q - \frac {p'}{2}- \frac {p^2}{4} \\ &= 5+2 \sec \left (x \right )^{2} - \frac {\left (2 \tan \left (x \right )\right )'}{2}- \frac {\left (2 \tan \left (x \right )\right )^2}{4} \\ &= 5+2 \sec \left (x \right )^{2} - \frac {\left (2+2 \tan \left (x \right )^{2}\right )}{2}- \frac {\left (4 \tan \left (x \right )^{2}\right )}{4} \\ &= 5+2 \sec \left (x \right )^{2} - \left (1+\tan \left (x \right )^{2}\right )-\tan \left (x \right )^{2}\\ &= 6 \end{align*}
Since the Liouville ode invariant does not depend on the independent variable \(x\) then the
transformation
\begin{align*} \xi = v \left (x \right ) z \left (x \right )\tag {3} \end{align*}
is used to change the original ode to a constant coefficients ode in \(v\). In (3) the term \(z \left (x \right )\) is given
by
\begin{align*} z \left (x \right )&={\mathrm e}^{-\left (\int \frac {p \left (x \right )}{2}d x \right )}\\ &= e^{-\int \frac {2 \tan \left (x \right )}{2} }\\ &= \cos \left (x \right )\tag {5} \end{align*}
Hence (3) becomes
\begin{align*} \xi = v \left (x \right ) \cos \left (x \right )\tag {4} \end{align*}
Applying this change of variable to the original ode results in
\begin{align*} \left (6 v \left (x \right )+v^{\prime \prime }\left (x \right )\right ) \cos \left (x \right ) = 0 \end{align*}
Which is now solved for \(v \left (x \right )\).
The above ode can be simplified to
\begin{align*} 6 v \left (x \right )+v^{\prime \prime }\left (x \right ) = 0 \end{align*}
This is second order with constant coefficients homogeneous ODE. In standard form the
ODE is
\[ A v''(x) + B v'(x) + C v(x) = 0 \]
Where in the above \(A=1, B=0, C=6\). Let the solution be \(v \left (x \right )=e^{\lambda x}\). Substituting this into the ODE gives
\[ \lambda ^{2} {\mathrm e}^{x \lambda }+6 \,{\mathrm e}^{x \lambda } = 0 \tag {1} \]
Since exponential function is never zero, then dividing Eq(2) throughout by \(e^{\lambda x}\) gives
\[ \lambda ^{2}+6 = 0 \tag {2} \]
Equation (2) is the characteristic equation of the ODE. Its roots determine the
general solution form.Using the quadratic formula
\[ \lambda _{1,2} = \frac {-B}{2 A} \pm \frac {1}{2 A} \sqrt {B^2 - 4 A C} \]
Substituting \(A=1, B=0, C=6\) into the above gives
\begin{align*} \lambda _{1,2} &= \frac {0}{(2) \left (1\right )} \pm \frac {1}{(2) \left (1\right )} \sqrt {0^2 - (4) \left (1\right )\left (6\right )}\\ &= \pm i \sqrt {6} \end{align*}
Hence
\begin{align*} \lambda _1 &= + i \sqrt {6}\\ \lambda _2 &= - i \sqrt {6} \end{align*}
Which simplifies to
\begin{align*}
\lambda _1 &= i \sqrt {6} \\
\lambda _2 &= -i \sqrt {6} \\
\end{align*}
Since roots are complex conjugate of each others, then let the
roots be
\[
\lambda _{1,2} = \alpha \pm i \beta
\]
Where \(\alpha =0\) and \(\beta =\sqrt {6}\). Therefore the final solution, when using Euler relation,
can be written as
\[
v \left (x \right ) = e^{\alpha x} \left ( c_1 \cos (\beta x) + c_2 \sin (\beta x) \right )
\]
Which becomes
\[
v \left (x \right ) = e^{0}\left (c_1 \cos \left (\sqrt {6}\, x \right )+c_2 \sin \left (\sqrt {6}\, x \right )\right )
\]
Or
\[
v \left (x \right ) = c_1 \cos \left (\sqrt {6}\, x \right )+c_2 \sin \left (\sqrt {6}\, x \right )
\]
Will add steps showing solving for IC
soon.
Now that \(v \left (x \right )\) is known, then
\begin{align*} \xi &= v \left (x \right ) z \left (x \right )\\ &= \left (c_1 \cos \left (\sqrt {6}\, x \right )+c_2 \sin \left (\sqrt {6}\, x \right )\right ) \left (z \left (x \right )\right )\tag {7} \end{align*}
But from (5)
\begin{align*} z \left (x \right )&= \cos \left (x \right ) \end{align*}
Hence (7) becomes
\begin{align*} \xi = \left (c_1 \cos \left (\sqrt {6}\, x \right )+c_2 \sin \left (\sqrt {6}\, x \right )\right ) \cos \left (x \right ) \end{align*}
Will add steps showing solving for IC soon.
The original ode (2) now reduces to first order ode
\begin{align*} \xi \left (x \right ) y^{\prime }-y \xi ^{\prime }\left (x \right )+\xi \left (x \right ) p \left (x \right ) y&=\int \xi \left (x \right ) r \left (x \right )d x\\ y^{\prime }+y \left (p \left (x \right )-\frac {\xi ^{\prime }\left (x \right )}{\xi \left (x \right )}\right )&=\frac {\int \xi \left (x \right ) r \left (x \right )d x}{\xi \left (x \right )}\\ y^{\prime }+y \left (-2 \tan \left (x \right )-\frac {\left (-c_1 \sqrt {6}\, \sin \left (\sqrt {6}\, x \right )+c_2 \sqrt {6}\, \cos \left (\sqrt {6}\, x \right )\right ) \cos \left (x \right )-\left (c_1 \cos \left (\sqrt {6}\, x \right )+c_2 \sin \left (\sqrt {6}\, x \right )\right ) \sin \left (x \right )}{\left (c_1 \cos \left (\sqrt {6}\, x \right )+c_2 \sin \left (\sqrt {6}\, x \right )\right ) \cos \left (x \right )}\right )&=\frac {-\frac {i c_1 \sqrt {\pi }\, {\mathrm e}^{\frac {3}{2}} \operatorname {erf}\left (i x -\frac {\sqrt {6}}{2}\right )}{4}-\frac {c_2 \sqrt {\pi }\, {\mathrm e}^{\frac {3}{2}} \operatorname {erf}\left (i x -\frac {\sqrt {6}}{2}\right )}{4}-\frac {i c_1 \sqrt {\pi }\, {\mathrm e}^{\frac {3}{2}} \operatorname {erf}\left (i x +\frac {\sqrt {6}}{2}\right )}{4}+\frac {c_2 \sqrt {\pi }\, {\mathrm e}^{\frac {3}{2}} \operatorname {erf}\left (i x +\frac {\sqrt {6}}{2}\right )}{4}}{\left (c_1 \cos \left (\sqrt {6}\, x \right )+c_2 \sin \left (\sqrt {6}\, x \right )\right ) \cos \left (x \right )} \end{align*}
Which is now a first order ode. This is now solved for \(y\). In canonical form a linear first order
is
\begin{align*} y^{\prime } + q(x)y &= p(x) \end{align*}
Comparing the above to the given ode shows that
\begin{align*} q(x) &=\frac {4 \sin \left (\sqrt {6}\, x \right ) \sqrt {6}\, \cos \left (x \right ) c_1 -8 \sin \left (\sqrt {6}\, x \right ) \tan \left (x \right ) \cos \left (x \right ) c_2 -4 \cos \left (\sqrt {6}\, x \right ) \sqrt {6}\, \cos \left (x \right ) c_2 -8 \cos \left (\sqrt {6}\, x \right ) \tan \left (x \right ) \cos \left (x \right ) c_1 +4 \sin \left (\sqrt {6}\, x \right ) \sin \left (x \right ) c_2 +4 \cos \left (\sqrt {6}\, x \right ) \sin \left (x \right ) c_1}{4 \left (c_1 \cos \left (\sqrt {6}\, x \right )+c_2 \sin \left (\sqrt {6}\, x \right )\right ) \cos \left (x \right )}\\ p(x) &=-\frac {i c_1 \sqrt {\pi }\, {\mathrm e}^{\frac {3}{2}} \operatorname {erf}\left (i x -\frac {\sqrt {6}}{2}\right )+i c_1 \sqrt {\pi }\, {\mathrm e}^{\frac {3}{2}} \operatorname {erf}\left (i x +\frac {\sqrt {6}}{2}\right )+c_2 \sqrt {\pi }\, {\mathrm e}^{\frac {3}{2}} \operatorname {erf}\left (i x -\frac {\sqrt {6}}{2}\right )-c_2 \sqrt {\pi }\, {\mathrm e}^{\frac {3}{2}} \operatorname {erf}\left (i x +\frac {\sqrt {6}}{2}\right )}{4 \left (c_1 \cos \left (\sqrt {6}\, x \right )+c_2 \sin \left (\sqrt {6}\, x \right )\right ) \cos \left (x \right )} \end{align*}
The integrating factor \(\mu \) is
\begin{align*} \mu &= e^{\int {q\,dx}}\\ &= {\mathrm e}^{\int \frac {4 \sin \left (\sqrt {6}\, x \right ) \sqrt {6}\, \cos \left (x \right ) c_1 -8 \sin \left (\sqrt {6}\, x \right ) \tan \left (x \right ) \cos \left (x \right ) c_2 -4 \cos \left (\sqrt {6}\, x \right ) \sqrt {6}\, \cos \left (x \right ) c_2 -8 \cos \left (\sqrt {6}\, x \right ) \tan \left (x \right ) \cos \left (x \right ) c_1 +4 \sin \left (\sqrt {6}\, x \right ) \sin \left (x \right ) c_2 +4 \cos \left (\sqrt {6}\, x \right ) \sin \left (x \right ) c_1}{4 \left (c_1 \cos \left (\sqrt {6}\, x \right )+c_2 \sin \left (\sqrt {6}\, x \right )\right ) \cos \left (x \right )}d x}\\ &= \frac {\cos \left (x \right )}{c_1 \cos \left (\sqrt {6}\, x \right )+c_2 \sin \left (\sqrt {6}\, x \right )} \end{align*}
The ode becomes
\begin{align*}
\frac {\mathop {\mathrm {d}}}{ \mathop {\mathrm {d}x}}\left ( \mu y\right ) &= \mu p \\
\frac {\mathop {\mathrm {d}}}{ \mathop {\mathrm {d}x}}\left ( \mu y\right ) &= \left (\mu \right ) \left (-\frac {i c_1 \sqrt {\pi }\, {\mathrm e}^{\frac {3}{2}} \operatorname {erf}\left (i x -\frac {\sqrt {6}}{2}\right )+i c_1 \sqrt {\pi }\, {\mathrm e}^{\frac {3}{2}} \operatorname {erf}\left (i x +\frac {\sqrt {6}}{2}\right )+c_2 \sqrt {\pi }\, {\mathrm e}^{\frac {3}{2}} \operatorname {erf}\left (i x -\frac {\sqrt {6}}{2}\right )-c_2 \sqrt {\pi }\, {\mathrm e}^{\frac {3}{2}} \operatorname {erf}\left (i x +\frac {\sqrt {6}}{2}\right )}{4 \left (c_1 \cos \left (\sqrt {6}\, x \right )+c_2 \sin \left (\sqrt {6}\, x \right )\right ) \cos \left (x \right )}\right ) \\
\frac {\mathop {\mathrm {d}}}{ \mathop {\mathrm {d}x}} \left (\frac {y \cos \left (x \right )}{c_1 \cos \left (\sqrt {6}\, x \right )+c_2 \sin \left (\sqrt {6}\, x \right )}\right ) &= \left (\frac {\cos \left (x \right )}{c_1 \cos \left (\sqrt {6}\, x \right )+c_2 \sin \left (\sqrt {6}\, x \right )}\right ) \left (-\frac {i c_1 \sqrt {\pi }\, {\mathrm e}^{\frac {3}{2}} \operatorname {erf}\left (i x -\frac {\sqrt {6}}{2}\right )+i c_1 \sqrt {\pi }\, {\mathrm e}^{\frac {3}{2}} \operatorname {erf}\left (i x +\frac {\sqrt {6}}{2}\right )+c_2 \sqrt {\pi }\, {\mathrm e}^{\frac {3}{2}} \operatorname {erf}\left (i x -\frac {\sqrt {6}}{2}\right )-c_2 \sqrt {\pi }\, {\mathrm e}^{\frac {3}{2}} \operatorname {erf}\left (i x +\frac {\sqrt {6}}{2}\right )}{4 \left (c_1 \cos \left (\sqrt {6}\, x \right )+c_2 \sin \left (\sqrt {6}\, x \right )\right ) \cos \left (x \right )}\right ) \\
\mathrm {d} \left (\frac {y \cos \left (x \right )}{c_1 \cos \left (\sqrt {6}\, x \right )+c_2 \sin \left (\sqrt {6}\, x \right )}\right ) &= \left (-\frac {i c_1 \sqrt {\pi }\, {\mathrm e}^{\frac {3}{2}} \operatorname {erf}\left (i x -\frac {\sqrt {6}}{2}\right )+i c_1 \sqrt {\pi }\, {\mathrm e}^{\frac {3}{2}} \operatorname {erf}\left (i x +\frac {\sqrt {6}}{2}\right )+c_2 \sqrt {\pi }\, {\mathrm e}^{\frac {3}{2}} \operatorname {erf}\left (i x -\frac {\sqrt {6}}{2}\right )-c_2 \sqrt {\pi }\, {\mathrm e}^{\frac {3}{2}} \operatorname {erf}\left (i x +\frac {\sqrt {6}}{2}\right )}{4 \left (c_1 \cos \left (\sqrt {6}\, x \right )+c_2 \sin \left (\sqrt {6}\, x \right )\right )^{2}}\right )\, \mathrm {d} x \\
\end{align*}
Integrating gives
\begin{align*} \frac {y \cos \left (x \right )}{c_1 \cos \left (\sqrt {6}\, x \right )+c_2 \sin \left (\sqrt {6}\, x \right )}&= \int {-\frac {i c_1 \sqrt {\pi }\, {\mathrm e}^{\frac {3}{2}} \operatorname {erf}\left (i x -\frac {\sqrt {6}}{2}\right )+i c_1 \sqrt {\pi }\, {\mathrm e}^{\frac {3}{2}} \operatorname {erf}\left (i x +\frac {\sqrt {6}}{2}\right )+c_2 \sqrt {\pi }\, {\mathrm e}^{\frac {3}{2}} \operatorname {erf}\left (i x -\frac {\sqrt {6}}{2}\right )-c_2 \sqrt {\pi }\, {\mathrm e}^{\frac {3}{2}} \operatorname {erf}\left (i x +\frac {\sqrt {6}}{2}\right )}{4 \left (c_1 \cos \left (\sqrt {6}\, x \right )+c_2 \sin \left (\sqrt {6}\, x \right )\right )^{2}} \,dx} \\ &=\int -\frac {i c_1 \sqrt {\pi }\, {\mathrm e}^{\frac {3}{2}} \operatorname {erf}\left (i x -\frac {\sqrt {6}}{2}\right )+i c_1 \sqrt {\pi }\, {\mathrm e}^{\frac {3}{2}} \operatorname {erf}\left (i x +\frac {\sqrt {6}}{2}\right )+c_2 \sqrt {\pi }\, {\mathrm e}^{\frac {3}{2}} \operatorname {erf}\left (i x -\frac {\sqrt {6}}{2}\right )-c_2 \sqrt {\pi }\, {\mathrm e}^{\frac {3}{2}} \operatorname {erf}\left (i x +\frac {\sqrt {6}}{2}\right )}{4 \left (c_1 \cos \left (\sqrt {6}\, x \right )+c_2 \sin \left (\sqrt {6}\, x \right )\right )^{2}}d x + c_3 \end{align*}
Dividing throughout by the integrating factor \(\frac {\cos \left (x \right )}{c_1 \cos \left (\sqrt {6}\, x \right )+c_2 \sin \left (\sqrt {6}\, x \right )}\) gives the final solution
\[ y = \frac {\left (c_1 \cos \left (\sqrt {6}\, x \right )+c_2 \sin \left (\sqrt {6}\, x \right )\right ) \left (\int -\frac {i c_1 \sqrt {\pi }\, {\mathrm e}^{\frac {3}{2}} \operatorname {erf}\left (i x -\frac {\sqrt {6}}{2}\right )+i c_1 \sqrt {\pi }\, {\mathrm e}^{\frac {3}{2}} \operatorname {erf}\left (i x +\frac {\sqrt {6}}{2}\right )+c_2 \sqrt {\pi }\, {\mathrm e}^{\frac {3}{2}} \operatorname {erf}\left (i x -\frac {\sqrt {6}}{2}\right )-c_2 \sqrt {\pi }\, {\mathrm e}^{\frac {3}{2}} \operatorname {erf}\left (i x +\frac {\sqrt {6}}{2}\right )}{4 \left (c_1 \cos \left (\sqrt {6}\, x \right )+c_2 \sin \left (\sqrt {6}\, x \right )\right )^{2}}d x +c_3 \right )}{\cos \left (x \right )} \]
Hence, the solution
found using Lagrange adjoint equation method is
\begin{align*}
y &= \frac {\left (c_1 \cos \left (\sqrt {6}\, x \right )+c_2 \sin \left (\sqrt {6}\, x \right )\right ) \left (\int -\frac {i c_1 \sqrt {\pi }\, {\mathrm e}^{\frac {3}{2}} \operatorname {erf}\left (i x -\frac {\sqrt {6}}{2}\right )+i c_1 \sqrt {\pi }\, {\mathrm e}^{\frac {3}{2}} \operatorname {erf}\left (i x +\frac {\sqrt {6}}{2}\right )+c_2 \sqrt {\pi }\, {\mathrm e}^{\frac {3}{2}} \operatorname {erf}\left (i x -\frac {\sqrt {6}}{2}\right )-c_2 \sqrt {\pi }\, {\mathrm e}^{\frac {3}{2}} \operatorname {erf}\left (i x +\frac {\sqrt {6}}{2}\right )}{4 \left (c_1 \cos \left (\sqrt {6}\, x \right )+c_2 \sin \left (\sqrt {6}\, x \right )\right )^{2}}d x +c_3 \right )}{\cos \left (x \right )} \\
\end{align*}
Will add steps showing solving for IC
soon.
2.33.4 Maple step by step solution
2.33.5 Maple trace
Methods for second order ODEs:
2.33.6 Maple dsolve solution
Solving time : 0.015
(sec)
Leaf size : 97
dsolve(diff(diff(y(x),x),x)-2*tan(x)*diff(y(x),x)+5*y(x) = exp(x^2)*sec(x),
y(x),singsol=all)
\[
y = -\frac {\sec \left (x \right ) \left (\left (i \sin \left (\sqrt {6}\, x \right )-\cos \left (\sqrt {6}\, x \right )\right ) \sqrt {6}\, \sqrt {\pi }\, {\mathrm e}^{\frac {3}{2}} \operatorname {erf}\left (i x -\frac {\sqrt {6}}{2}\right )+\sqrt {6}\, \sqrt {\pi }\, {\mathrm e}^{\frac {3}{2}} \left (i \sin \left (\sqrt {6}\, x \right )+\cos \left (\sqrt {6}\, x \right )\right ) \operatorname {erf}\left (i x +\frac {\sqrt {6}}{2}\right )-24 c_2 \sin \left (\sqrt {6}\, x \right )-24 c_1 \cos \left (\sqrt {6}\, x \right )\right )}{24}
\]
2.33.7 Mathematica DSolve solution
Solving time : 0.416
(sec)
Leaf size : 118
DSolve[{D[y[x],{x,2}]-2*Tan[x]*D[y[x],x]+5*y[x]==Exp[x^2]*Sec[x],{}},
y[x],x,IncludeSingularSolutions->True]
\[
y(x)\to \frac {1}{24} e^{-i \sqrt {6} x} \sec (x) \left (-e^{3/2} \sqrt {6 \pi } \text {erf}\left (\sqrt {\frac {3}{2}}-i x\right )-\sqrt {6 \pi } e^{\frac {3}{2}+2 i \sqrt {6} x} \text {erf}\left (\sqrt {\frac {3}{2}}+i x\right )-2 i \sqrt {6} c_2 e^{2 i \sqrt {6} x}+24 c_1\right )
\]