2.5.18 problem 18
Internal
problem
ID
[8655]
Book
:
Own
collection
of
miscellaneous
problems
Section
:
section
5.0
Problem
number
:
18
Date
solved
:
Thursday, December 12, 2024 at 09:37:48 AM
CAS
classification
:
[[_2nd_order, _linear, _nonhomogeneous]]
Solve
\begin{align*} y^{\prime \prime }+y&={\mathrm e}^{a \cos \left (x \right )} \end{align*}
Using series expansion around \(x=0\)
Solving ode using Taylor series method. This gives review on how the Taylor series method
works for solving second order ode.
Let
\[ y^{\prime \prime }=f\left ( x,y,y^{\prime }\right ) \]
Assuming expansion is at \(x_{0}=0\) (we can always shift the actual expansion point to \(0\) by change
of variables) and assuming \(f\left ( x,y,y^{\prime }\right ) \) is analytic at \(x_{0}\) which must be the case for an ordinary point. Let
initial conditions be \(y\left ( x_{0}\right ) =y_{0}\) and \(y^{\prime }\left ( x_{0}\right ) =y_{0}^{\prime }\) . Using Taylor series gives
\begin{align*} y\left ( x\right ) & =y\left ( x_{0}\right ) +\left ( x-x_{0}\right ) y^{\prime }\left ( x_{0}\right ) +\frac {\left ( x-x_{0}\right ) ^{2}}{2}y^{\prime \prime }\left ( x_{0}\right ) +\frac {\left ( x-x_{0}\right ) ^{3}}{3!}y^{\prime \prime \prime }\left ( x_{0}\right ) +\cdots \\ & =y_{0}+xy_{0}^{\prime }+\frac {x^{2}}{2}\left . f\right \vert _{x_{0},y_{0},y_{0}^{\prime }}+\frac {x^{3}}{3!}\left . f^{\prime }\right \vert _{x_{0},y_{0},y_{0}^{\prime }}+\cdots \\ & =y_{0}+xy_{0}^{\prime }+\sum _{n=0}^{\infty }\frac {x^{n+2}}{\left ( n+2\right ) !}\left . \frac {d^{n}f}{dx^{n}}\right \vert _{x_{0},y_{0},y_{0}^{\prime }}\end{align*}
But
\begin{align} \frac {df}{dx} & =\frac {\partial f}{\partial x}\frac {dx}{dx}+\frac {\partial f}{\partial y}\frac {dy}{dx}+\frac {\partial f}{\partial y^{\prime }}\frac {dy^{\prime }}{dx}\tag {1}\\ & =\frac {\partial f}{\partial x}+\frac {\partial f}{\partial y}y^{\prime }+\frac {\partial f}{\partial y^{\prime }}y^{\prime \prime }\\ & =\frac {\partial f}{\partial x}+\frac {\partial f}{\partial y}y^{\prime }+\frac {\partial f}{\partial y^{\prime }}f\\ \frac {d^{2}f}{dx^{2}} & =\frac {d}{dx}\left ( \frac {df}{dx}\right ) \nonumber \\ & =\frac {\partial }{\partial x}\left ( \frac {df}{dx}\right ) +\frac {\partial }{\partial y}\left ( \frac {df}{dx}\right ) y^{\prime }+\frac {\partial }{\partial y^{\prime }}\left ( \frac {df}{dx}\right ) f\tag {2}\\ \frac {d^{3}f}{dx^{3}} & =\frac {d}{dx}\left ( \frac {d^{2}f}{dx^{2}}\right ) \nonumber \\ & =\frac {\partial }{\partial x}\left ( \frac {d^{2}f}{dx^{2}}\right ) +\left ( \frac {\partial }{\partial y}\frac {d^{2}f}{dx^{2}}\right ) y^{\prime }+\frac {\partial }{\partial y^{\prime }}\left ( \frac {d^{2}f}{dx^{2}}\right ) f\tag {3}\\ & \vdots \nonumber \end{align}
And so on. Hence if we name \(F_{0}=f\left ( x,y,y^{\prime }\right ) \) then the above can be written as
\begin{align} F_{0} & =f\left ( x,y,y^{\prime }\right ) \tag {4}\\ F_{1} & =\frac {df}{dx}\nonumber \\ & =\frac {dF_{0}}{dx}\nonumber \\ & =\frac {\partial f}{\partial x}+\frac {\partial f}{\partial y}y^{\prime }+\frac {\partial f}{\partial y^{\prime }}y^{\prime \prime }\nonumber \\ & =\frac {\partial f}{\partial x}+\frac {\partial f}{\partial y}y^{\prime }+\frac {\partial f}{\partial y^{\prime }}f\tag {5}\\ & =\frac {\partial F_{0}}{\partial x}+\frac {\partial F_{0}}{\partial y}y^{\prime }+\frac {\partial F_{0}}{\partial y^{\prime }}F_{0}\nonumber \\ F_{2} & =\frac {d}{dx}\left ( \frac {d}{dx}f\right ) \nonumber \\ & =\frac {d}{dx}\left ( F_{1}\right ) \nonumber \\ & =\frac {\partial }{\partial x}F_{1}+\left ( \frac {\partial F_{1}}{\partial y}\right ) y^{\prime }+\left ( \frac {\partial F_{1}}{\partial y^{\prime }}\right ) y^{\prime \prime }\nonumber \\ & =\frac {\partial }{\partial x}F_{1}+\left ( \frac {\partial F_{1}}{\partial y}\right ) y^{\prime }+\left ( \frac {\partial F_{1}}{\partial y^{\prime }}\right ) F_{0}\nonumber \\ & \vdots \nonumber \\ F_{n} & =\frac {d}{dx}\left ( F_{n-1}\right ) \nonumber \\ & =\frac {\partial }{\partial x}F_{n-1}+\left ( \frac {\partial F_{n-1}}{\partial y}\right ) y^{\prime }+\left ( \frac {\partial F_{n-1}}{\partial y^{\prime }}\right ) y^{\prime \prime }\nonumber \\ & =\frac {\partial }{\partial x}F_{n-1}+\left ( \frac {\partial F_{n-1}}{\partial y}\right ) y^{\prime }+\left ( \frac {\partial F_{n-1}}{\partial y^{\prime }}\right ) F_{0} \tag {6}\end{align}
Therefore (6) can be used from now on along with
\begin{equation} y\left ( x\right ) =y_{0}+xy_{0}^{\prime }+\sum _{n=0}^{\infty }\frac {x^{n+2}}{\left ( n+2\right ) !}\left . F_{n}\right \vert _{x_{0},y_{0},y_{0}^{\prime }} \tag {7}\end{equation}
To find \(y\left ( x\right ) \) series solution around \(x=0\) . Hence
\begin{align*} F_0 &= {\mathrm e}^{a \cos \left (x \right )}-y\\ F_1 &= \frac {d F_0}{dx} \\ &= \frac {\partial F_{0}}{\partial x}+ \frac {\partial F_{0}}{\partial y} y^{\prime }+ \frac {\partial F_{0}}{\partial y^{\prime }} F_0 \\ &= -a \sin \left (x \right ) {\mathrm e}^{a \cos \left (x \right )}-y^{\prime }\\ F_2 &= \frac {d F_1}{dx} \\ &= \frac {\partial F_{1}}{\partial x}+ \frac {\partial F_{1}}{\partial y} y^{\prime }+ \frac {\partial F_{1}}{\partial y^{\prime }} F_1 \\ &= {\mathrm e}^{a \cos \left (x \right )} \left (a^{2} \sin \left (x \right )^{2}-a \cos \left (x \right )-1\right )+y\\ F_3 &= \frac {d F_2}{dx} \\ &= \frac {\partial F_{2}}{\partial x}+ \frac {\partial F_{2}}{\partial y} y^{\prime }+ \frac {\partial F_{2}}{\partial y^{\prime }} F_2 \\ &= -a \sin \left (x \right ) \left (a^{2} \sin \left (x \right )^{2}-3 a \cos \left (x \right )-2\right ) {\mathrm e}^{a \cos \left (x \right )}+y^{\prime }\\ F_4 &= \frac {d F_3}{dx} \\ &= \frac {\partial F_{3}}{\partial x}+ \frac {\partial F_{3}}{\partial y} y^{\prime }+ \frac {\partial F_{3}}{\partial y^{\prime }} F_3 \\ &= \left (8 a^{2} \cos \left (x \right )^{2}+\left (-6 a^{3} \sin \left (x \right )^{2}+2 a \right ) \cos \left (x \right )+\sin \left (x \right )^{4} a^{4}-5 a^{2}+1\right ) {\mathrm e}^{a \cos \left (x \right )}-y\\ F_5 &= \frac {d F_4}{dx} \\ &= \frac {\partial F_{4}}{\partial x}+ \frac {\partial F_{4}}{\partial y} y^{\prime }+ \frac {\partial F_{4}}{\partial y^{\prime }} F_4 \\ &= -a \sin \left (x \right ) \left (\sin \left (x \right )^{4} a^{4}-10 \cos \left (x \right ) \sin \left (x \right )^{2} a^{3}+26 a^{2} \cos \left (x \right )^{2}+18 a \cos \left (x \right )-11 a^{2}+3\right ) {\mathrm e}^{a \cos \left (x \right )}-y^{\prime }\\ F_6 &= \frac {d F_5}{dx} \\ &= \frac {\partial F_{5}}{\partial x}+ \frac {\partial F_{5}}{\partial y} y^{\prime }+ \frac {\partial F_{5}}{\partial y^{\prime }} F_5 \\ &= \left (-96 a^{3} \cos \left (x \right )^{3}+\left (66 \sin \left (x \right )^{2} a^{4}-39 a^{2}\right ) \cos \left (x \right )^{2}+\left (-15 a^{5} \sin \left (x \right )^{4}+81 a^{3}-3 a \right ) \cos \left (x \right )+\sin \left (x \right )^{6} a^{6}-21 \sin \left (x \right )^{2} a^{4}+21 a^{2}-1\right ) {\mathrm e}^{a \cos \left (x \right )}+y \end{align*}
And so on. Evaluating all the above at initial conditions \(x = 0\) and \(y \left (0\right ) = y \left (0\right )\) and \(y^{\prime }\left (0\right ) = y^{\prime }\left (0\right )\) gives
\begin{align*} F_0 &= {\mathrm e}^{a}-y \left (0\right )\\ F_1 &= -y^{\prime }\left (0\right )\\ F_2 &= -{\mathrm e}^{a} a -{\mathrm e}^{a}+y \left (0\right )\\ F_3 &= y^{\prime }\left (0\right )\\ F_4 &= 3 \,{\mathrm e}^{a} a^{2}+2 \,{\mathrm e}^{a} a +{\mathrm e}^{a}-y \left (0\right )\\ F_5 &= -y^{\prime }\left (0\right )\\ F_6 &= -15 \,{\mathrm e}^{a} a^{3}-18 \,{\mathrm e}^{a} a^{2}-3 \,{\mathrm e}^{a} a -{\mathrm e}^{a}+y \left (0\right ) \end{align*}
Substituting all the above in (7) and simplifying gives the solution as
\[
y = \left (1-\frac {1}{2} x^{2}+\frac {1}{24} x^{4}-\frac {1}{720} x^{6}\right ) y \left (0\right )+\left (x -\frac {1}{6} x^{3}+\frac {1}{120} x^{5}-\frac {1}{5040} x^{7}\right ) y^{\prime }\left (0\right )+\frac {x^{2} {\mathrm e}^{a}}{2}-\frac {x^{4} {\mathrm e}^{a} a}{24}-\frac {x^{4} {\mathrm e}^{a}}{24}+\frac {x^{6} {\mathrm e}^{a} a^{2}}{240}+\frac {x^{6} {\mathrm e}^{a} a}{360}+\frac {x^{6} {\mathrm e}^{a}}{720}+O\left (x^{8}\right )
\]
Since the expansion
point \(x = 0\) is an ordinary point, then this can also be solved using the standard power
series method. Let the solution be represented as power series of the form
\[ y = \moverset {\infty }{\munderset {n =0}{\sum }}a_{n} x^{n} \]
Then
\begin{align*} y^{\prime } &= \moverset {\infty }{\munderset {n =1}{\sum }}n a_{n} x^{n -1}\\ y^{\prime \prime } &= \moverset {\infty }{\munderset {n =2}{\sum }}n \left (n -1\right ) a_{n} x^{n -2} \end{align*}
Substituting the above back into the ode gives
\begin{align*} \left (\moverset {\infty }{\munderset {n =2}{\sum }}n \left (n -1\right ) a_{n} x^{n -2}\right )+\left (\moverset {\infty }{\munderset {n =0}{\sum }}a_{n} x^{n}\right ) = {\mathrm e}^{a \cos \left (x \right )}\tag {1} \end{align*}
Expanding \({\mathrm e}^{a \cos \left (x \right )}\) as Taylor series around \(x=0\) and keeping only the first \(8\) terms gives
\begin{align*} {\mathrm e}^{a \cos \left (x \right )} &= {\mathrm e}^{a}-\frac {{\mathrm e}^{a} a \,x^{2}}{2}+{\mathrm e}^{a} \left (\frac {1}{24} a +\frac {1}{8} a^{2}\right ) x^{4}+{\mathrm e}^{a} \left (-\frac {1}{720} a -\frac {1}{48} a^{2}-\frac {1}{48} a^{3}\right ) x^{6} + \dots \\ &= {\mathrm e}^{a}-\frac {{\mathrm e}^{a} a \,x^{2}}{2}+{\mathrm e}^{a} \left (\frac {1}{24} a +\frac {1}{8} a^{2}\right ) x^{4}+{\mathrm e}^{a} \left (-\frac {1}{720} a -\frac {1}{48} a^{2}-\frac {1}{48} a^{3}\right ) x^{6} \end{align*}
Hence the ODE in Eq (1) becomes
\[
\left (\moverset {\infty }{\munderset {n =2}{\sum }}n \left (n -1\right ) a_{n} x^{n -2}\right )+\left (\moverset {\infty }{\munderset {n =0}{\sum }}a_{n} x^{n}\right ) = {\mathrm e}^{a}-\frac {{\mathrm e}^{a} a \,x^{2}}{2}+{\mathrm e}^{a} \left (\frac {1}{24} a +\frac {1}{8} a^{2}\right ) x^{4}+{\mathrm e}^{a} \left (-\frac {1}{720} a -\frac {1}{48} a^{2}-\frac {1}{48} a^{3}\right ) x^{6}
\]
Which simplifies to
\begin{equation}
\tag{2} \left (\moverset {\infty }{\munderset {n =2}{\sum }}n \left (n -1\right ) a_{n} x^{n -2}\right )+\left (\moverset {\infty }{\munderset {n =0}{\sum }}a_{n} x^{n}\right ) = {\mathrm e}^{a}-\frac {{\mathrm e}^{a} a \,x^{2}}{2}+{\mathrm e}^{a} \left (\frac {1}{24} a +\frac {1}{8} a^{2}\right ) x^{4}+{\mathrm e}^{a} \left (-\frac {1}{720} a -\frac {1}{48} a^{2}-\frac {1}{48} a^{3}\right ) x^{6}
\end{equation}
The next step is to make all powers
of \(x\) be \(n\) in each summation term. Going over each summation term above with power of \(x\) in it
which is not already \(x^{n}\) and adjusting the power and the corresponding index gives
\begin{align*}
\moverset {\infty }{\munderset {n =2}{\sum }}n \left (n -1\right ) a_{n} x^{n -2} &= \moverset {\infty }{\munderset {n =0}{\sum }}\left (n +2\right ) a_{n +2} \left (n +1\right ) x^{n} \\
\end{align*}
Substituting all the above in Eq (2) gives the following equation where now all powers of \(x\) are
the same and equal to \(n\) .
\begin{equation}
\tag{3} \left (\moverset {\infty }{\munderset {n =0}{\sum }}\left (n +2\right ) a_{n +2} \left (n +1\right ) x^{n}\right )+\left (\moverset {\infty }{\munderset {n =0}{\sum }}a_{n} x^{n}\right ) = {\mathrm e}^{a}-\frac {{\mathrm e}^{a} a \,x^{2}}{2}+{\mathrm e}^{a} \left (\frac {1}{24} a +\frac {1}{8} a^{2}\right ) x^{4}+{\mathrm e}^{a} \left (-\frac {1}{720} a -\frac {1}{48} a^{2}-\frac {1}{48} a^{3}\right ) x^{6}
\end{equation}
For \(0\le n\) , the recurrence equation is
\begin{equation}
\tag{4} \left (\left (n +2\right ) a_{n +2} \left (n +1\right )+a_{n}\right ) x^{n} = {\mathrm e}^{a}-\frac {{\mathrm e}^{a} a \,x^{2}}{2}+{\mathrm e}^{a} \left (\frac {1}{24} a +\frac {1}{8} a^{2}\right ) x^{4}+{\mathrm e}^{a} \left (-\frac {1}{720} a -\frac {1}{48} a^{2}-\frac {1}{48} a^{3}\right ) x^{6}
\end{equation}
For \(n = 0\) the recurrence equation gives
\begin{align*}
\left (2 a_{2}+a_{0}\right ) 1&={\mathrm e}^{a} \\
2 a_{2}+a_{0} &= {\mathrm e}^{a} \\
\end{align*}
Which after substituting the earlier terms found becomes
\[
a_{2} = \frac {{\mathrm e}^{a}}{2}-\frac {a_{0}}{2}
\]
For \(n = 1\) the recurrence equation gives
\begin{align*}
\left (6 a_{3}+a_{1}\right ) x&=0 \\
6 a_{3}+a_{1} &= 0 \\
\end{align*}
Which after substituting the earlier terms found becomes
\[
a_{3} = -\frac {a_{1}}{6}
\]
For \(n = 2\) the recurrence equation gives
\begin{align*}
\left (12 a_{4}+a_{2}\right ) x^{2}&=-\frac {{\mathrm e}^{a} a \,x^{2}}{2} \\
12 a_{4}+a_{2} &= -\frac {{\mathrm e}^{a} a}{2} \\
\end{align*}
Which after substituting the earlier terms found becomes
\[
a_{4} = -\frac {{\mathrm e}^{a} a}{24}-\frac {{\mathrm e}^{a}}{24}+\frac {a_{0}}{24}
\]
For \(n = 3\) the recurrence
equation gives
\begin{align*}
\left (20 a_{5}+a_{3}\right ) x^{3}&=0 \\
20 a_{5}+a_{3} &= 0 \\
\end{align*}
Which after substituting the earlier terms found becomes
\[
a_{5} = \frac {a_{1}}{120}
\]
For \(n = 4\)
the recurrence equation gives
\begin{align*}
\left (30 a_{6}+a_{4}\right ) x^{4}&={\mathrm e}^{a} \left (\frac {1}{24} a +\frac {1}{8} a^{2}\right ) x^{4} \\
30 a_{6}+a_{4} &= {\mathrm e}^{a} \left (\frac {1}{24} a +\frac {1}{8} a^{2}\right ) \\
\end{align*}
Which after substituting the earlier terms found
becomes
\[
a_{6} = \frac {{\mathrm e}^{a} a}{360}+\frac {{\mathrm e}^{a} a^{2}}{240}+\frac {{\mathrm e}^{a}}{720}-\frac {a_{0}}{720}
\]
For \(n = 5\) the recurrence equation gives
\begin{align*}
\left (42 a_{7}+a_{5}\right ) x^{5}&=0 \\
42 a_{7}+a_{5} &= 0 \\
\end{align*}
Which after substituting the earlier
terms found becomes
\[
a_{7} = -\frac {a_{1}}{5040}
\]
For \(n = 6\) the recurrence equation gives
\begin{align*}
\left (56 a_{8}+a_{6}\right ) x^{6}&={\mathrm e}^{a} \left (-\frac {1}{720} a -\frac {1}{48} a^{2}-\frac {1}{48} a^{3}\right ) x^{6} \\
56 a_{8}+a_{6} &= {\mathrm e}^{a} \left (-\frac {1}{720} a -\frac {1}{48} a^{2}-\frac {1}{48} a^{3}\right ) \\
\end{align*}
Which after substituting
the earlier terms found becomes
\[
a_{8} = -\frac {{\mathrm e}^{a} a}{13440}-\frac {{\mathrm e}^{a} a^{2}}{2240}-\frac {{\mathrm e}^{a} a^{3}}{2688}-\frac {{\mathrm e}^{a}}{40320}+\frac {a_{0}}{40320}
\]
For \(n = 7\) the recurrence equation gives
\begin{align*}
\left (72 a_{9}+a_{7}\right ) x^{7}&=0 \\
72 a_{9}+a_{7} &= 0 \\
\end{align*}
Which after
substituting the earlier terms found becomes
\[
a_{9} = \frac {a_{1}}{362880}
\]
And so on. Therefore the solution is
\begin{align*} y &= \moverset {\infty }{\munderset {n =0}{\sum }}a_{n} x^{n}\\ &= a_{3} x^{3}+a_{2} x^{2}+a_{1} x +a_{0} + \dots \end{align*}
Substituting the values for \(a_{n}\) found above, the solution becomes
\[
y = a_{0}+a_{1} x +\left (\frac {{\mathrm e}^{a}}{2}-\frac {a_{0}}{2}\right ) x^{2}-\frac {a_{1} x^{3}}{6}+\left (-\frac {{\mathrm e}^{a} a}{24}-\frac {{\mathrm e}^{a}}{24}+\frac {a_{0}}{24}\right ) x^{4}+\frac {a_{1} x^{5}}{120}+\left (\frac {{\mathrm e}^{a} a}{360}+\frac {{\mathrm e}^{a} a^{2}}{240}+\frac {{\mathrm e}^{a}}{720}-\frac {a_{0}}{720}\right ) x^{6}-\frac {a_{1} x^{7}}{5040}+\dots
\]
Collecting terms, the solution
becomes
\begin{equation}
\tag{3} y = \left (1-\frac {1}{2} x^{2}+\frac {1}{24} x^{4}-\frac {1}{720} x^{6}\right ) a_{0}+\left (x -\frac {1}{6} x^{3}+\frac {1}{120} x^{5}-\frac {1}{5040} x^{7}\right ) a_{1}+\frac {x^{2} {\mathrm e}^{a}}{2}+\left (-\frac {{\mathrm e}^{a} a}{24}-\frac {{\mathrm e}^{a}}{24}\right ) x^{4}+\left (\frac {{\mathrm e}^{a} a}{360}+\frac {{\mathrm e}^{a} a^{2}}{240}+\frac {{\mathrm e}^{a}}{720}\right ) x^{6}+O\left (x^{8}\right )
\end{equation}
At \(x = 0\) the solution above becomes
\[
y = \left (1-\frac {1}{2} x^{2}+\frac {1}{24} x^{4}-\frac {1}{720} x^{6}\right ) c_1 +\left (x -\frac {1}{6} x^{3}+\frac {1}{120} x^{5}-\frac {1}{5040} x^{7}\right ) c_2 +\frac {x^{2} {\mathrm e}^{a}}{2}+\left (-\frac {{\mathrm e}^{a} a}{24}-\frac {{\mathrm e}^{a}}{24}\right ) x^{4}+\left (\frac {{\mathrm e}^{a} a}{360}+\frac {{\mathrm e}^{a} a^{2}}{240}+\frac {{\mathrm e}^{a}}{720}\right ) x^{6}+O\left (x^{8}\right )
\]
Figure 2.229: Slope field plot
\(y^{\prime \prime }+y = {\mathrm e}^{a \cos \left (x \right )}\)
Maple step by step solution
\[ \begin {array}{lll} & {} & \textrm {Let's solve}\hspace {3pt} \\ {} & {} & \frac {d^{2}}{d x^{2}}y \left (x \right )+y \left (x \right )={\mathrm e}^{a \cos \left (x \right )} \\ \bullet & {} & \textrm {Highest derivative means the order of the ODE is}\hspace {3pt} 2 \\ {} & {} & \frac {d^{2}}{d x^{2}}y \left (x \right ) \\ \bullet & {} & \textrm {Characteristic polynomial of homogeneous ODE}\hspace {3pt} \\ {} & {} & r^{2}+1=0 \\ \bullet & {} & \textrm {Use quadratic formula to solve for}\hspace {3pt} r \\ {} & {} & r =\frac {0\pm \left (\sqrt {-4}\right )}{2} \\ \bullet & {} & \textrm {Roots of the characteristic polynomial}\hspace {3pt} \\ {} & {} & r =\left (\mathrm {-I}, \mathrm {I}\right ) \\ \bullet & {} & \textrm {1st solution of the homogeneous ODE}\hspace {3pt} \\ {} & {} & y_{1}\left (x \right )=\cos \left (x \right ) \\ \bullet & {} & \textrm {2nd solution of the homogeneous ODE}\hspace {3pt} \\ {} & {} & y_{2}\left (x \right )=\sin \left (x \right ) \\ \bullet & {} & \textrm {General solution of the ODE}\hspace {3pt} \\ {} & {} & y \left (x \right )=\mathit {C1} y_{1}\left (x \right )+\mathit {C2} y_{2}\left (x \right )+y_{p}\left (x \right ) \\ \bullet & {} & \textrm {Substitute in solutions of the homogeneous ODE}\hspace {3pt} \\ {} & {} & y \left (x \right )=\mathit {C1} \cos \left (x \right )+\mathit {C2} \sin \left (x \right )+y_{p}\left (x \right ) \\ \square & {} & \textrm {Find a particular solution}\hspace {3pt} y_{p}\left (x \right )\hspace {3pt}\textrm {of the ODE}\hspace {3pt} \\ {} & \circ & \textrm {Use variation of parameters to find}\hspace {3pt} y_{p}\hspace {3pt}\textrm {here}\hspace {3pt} f \left (x \right )\hspace {3pt}\textrm {is the forcing function}\hspace {3pt} \\ {} & {} & \left [y_{p}\left (x \right )=-y_{1}\left (x \right ) \left (\int \frac {y_{2}\left (x \right ) f \left (x \right )}{W \left (y_{1}\left (x \right ), y_{2}\left (x \right )\right )}d x \right )+y_{2}\left (x \right ) \left (\int \frac {y_{1}\left (x \right ) f \left (x \right )}{W \left (y_{1}\left (x \right ), y_{2}\left (x \right )\right )}d x \right ), f \left (x \right )={\mathrm e}^{a \cos \left (x \right )}\right ] \\ {} & \circ & \textrm {Wronskian of solutions of the homogeneous equation}\hspace {3pt} \\ {} & {} & W \left (y_{1}\left (x \right ), y_{2}\left (x \right )\right )=\left [\begin {array}{cc} \cos \left (x \right ) & \sin \left (x \right ) \\ -\sin \left (x \right ) & \cos \left (x \right ) \end {array}\right ] \\ {} & \circ & \textrm {Compute Wronskian}\hspace {3pt} \\ {} & {} & W \left (y_{1}\left (x \right ), y_{2}\left (x \right )\right )=1 \\ {} & \circ & \textrm {Substitute functions into equation for}\hspace {3pt} y_{p}\left (x \right ) \\ {} & {} & y_{p}\left (x \right )=-\cos \left (x \right ) \left (\int \sin \left (x \right ) {\mathrm e}^{a \cos \left (x \right )}d x \right )+\sin \left (x \right ) \left (\int \cos \left (x \right ) {\mathrm e}^{a \cos \left (x \right )}d x \right ) \\ {} & \circ & \textrm {Compute integrals}\hspace {3pt} \\ {} & {} & y_{p}\left (x \right )=\frac {\sin \left (x \right ) \left (\int \cos \left (x \right ) {\mathrm e}^{a \cos \left (x \right )}d x \right ) a +\cos \left (x \right ) {\mathrm e}^{a \cos \left (x \right )}}{a} \\ \bullet & {} & \textrm {Substitute particular solution into general solution to ODE}\hspace {3pt} \\ {} & {} & y \left (x \right )=\mathit {C1} \cos \left (x \right )+\mathit {C2} \sin \left (x \right )+\frac {\sin \left (x \right ) \left (\int \cos \left (x \right ) {\mathrm e}^{a \cos \left (x \right )}d x \right ) a +\cos \left (x \right ) {\mathrm e}^{a \cos \left (x \right )}}{a} \end {array} \]
Maple trace
` Methods for second order ODEs:
--- Trying classification methods ---
trying a quadrature
trying high order exact linear fully integrable
trying differential order: 2; linear nonhomogeneous with symmetry [0,1]
trying a double symmetry of the form [xi=0, eta=F(x)]
-> Try solving first the homogeneous part of the ODE
checking if the LODE has constant coefficients
<- constant coefficients successful
<- solving first the homogeneous part of the ODE successful `
Maple dsolve solution
Solving time : 0.007
(sec)
Leaf size : 85
dsolve ( diff ( diff ( y ( x ), x ), x )+ y ( x ) = exp ( a * cos ( x )), y ( x ),
series , x =0)
\[
y = \left (-\frac {1}{720} x^{6}+\frac {1}{24} x^{4}+1-\frac {1}{2} x^{2}\right ) y \left (0\right )+\left (x -\frac {1}{6} x^{3}+\frac {1}{120} x^{5}-\frac {1}{5040} x^{7}\right ) y^{\prime }\left (0\right )+\frac {{\mathrm e}^{a} x^{2}}{2}+\frac {\left (-a -1\right ) {\mathrm e}^{a} x^{4}}{24}+\frac {\left (3 a^{2}+2 a +1\right ) {\mathrm e}^{a} x^{6}}{720}+O\left (x^{8}\right )
\]
Mathematica DSolve solution
Solving time : 0.035
(sec)
Leaf size : 239
AsymptoticDSolveValue [{ D [ y [ x ],{ x ,2}]+ y [ x ]== Exp [ a * Cos [ x ]],{}},
y[x],{x,0,7}]
\[
y(x)\to \left (-\frac {x^7}{5040}+\frac {x^5}{120}-\frac {x^3}{6}+x\right ) \left (\frac {1}{120} \left (3 a^2+7 a+1\right ) e^a x^5-\frac {\left (15 a^3+60 a^2+31 a+1\right ) e^a x^7}{5040}-\frac {1}{6} (a+1) e^a x^3+e^a x\right )+\left (-\frac {x^6}{720}+\frac {x^4}{24}-\frac {x^2}{2}+1\right ) \left (-\frac {1}{720} \left (15 a^2+15 a+1\right ) e^a x^6+\frac {\left (105 a^3+210 a^2+63 a+1\right ) e^a x^8}{40320}+\frac {1}{24} (3 a+1) e^a x^4-\frac {e^a x^2}{2}\right )+c_2 \left (-\frac {x^7}{5040}+\frac {x^5}{120}-\frac {x^3}{6}+x\right )+c_1 \left (-\frac {x^6}{720}+\frac {x^4}{24}-\frac {x^2}{2}+1\right )
\]