1.3.4 Secondary Algorithm

There are cases when the main algorithm fail. For example, let the ode be \(y^{\prime }+y\cot \left ( x\right ) =\cos \left ( x\right ) \) with IC \(y\left ( 0\right ) =0\). The general solution is

\[ y=-\frac {1}{2}\cos x\cot x+\frac {c_{1}}{\sin x}\]

If we follow the main algorithm and plug-in the general solution into the IC, we obtain

\[ 0=\infty +\frac {c_{1}}{0}\]
Even if we take the limit of \(\lim _{x\rightarrow 0}\left ( -\frac {1}{2}\cos x\cot x+\frac {c_{1}}{\sin x}\right ) \). This does not help. In this case, we start by solving for \(c_{1}\) from the general solution. This gives
\[ c_{1}=\frac {1}{2}\sin x\left ( \cos x\cot x+2y\right ) \]
And now take the bidirectional limit.
\begin{align*} c_{1} & =\lim _{x\rightarrow 0}\lim _{y->0}\left ( \frac {1}{2}\sin x\left ( \cos x\cot x+2y\right ) \right ) \\ & =\frac {1}{2}\end{align*}

Also the order can make difference. If we do

\[ c_{1}=\lim _{y->0}\lim _{x\rightarrow 0}\left ( \frac {1}{2}\sin x\left ( \cos x\cot x+2y\right ) \right ) \]
Then it will not work. So we have to try both orders to see if it is possible to solve for \(c_{1}\).

This method also works if we have more than one IC (say for second order ode). Let the solution for second order be

\[ y=c_{1}x+c_{2}x^{2}\]

And let the IC be

\begin{align*} y\left ( x_{0}\right ) & =y_{0}\\ y^{\prime }\left ( x_{0}\right ) & =y_{0}^{\prime }\end{align*}

For the first IC, We start by generating one equation for each \(c_{i}\) by solving for these from general solution. This gives

\begin{align} c_{1} & =\frac {y-c_{2}x^{2}}{x}\tag {1}\\ c_{2} & =\frac {y-c_{1}x}{x^{2}} \tag {2}\end{align}

Applying the limit

\begin{align} c_{1} & =\lim _{y\rightarrow y_{0}}\lim _{x\rightarrow x_{0}}\frac {y-c_{2}x^{2}}{x}\tag {1A}\\ c_{2} & =\lim _{y\rightarrow y_{0}}\lim _{x\rightarrow x_{0}}\frac {y-c_{1}x}{x^{2}} \tag {2A}\end{align}

Now we apply the second IC. For this we have to first differentiate the solution which gives

\[ y^{\prime }=c_{1}+2c_{2}x \]
Solving for the \(c_{i}\) again gives
\begin{align} c_{1} & =y^{\prime }-2c_{2}x\tag {3}\\ c_{2} & =\frac {y^{\prime }-c_{1}}{2x} \tag {4}\end{align}

And now we apply the second IC to (3,4) giving

\begin{align} c_{1} & =\lim _{y^{\prime }\rightarrow y_{0}^{\prime }}\lim _{x\rightarrow x_{0}}y^{\prime }-2c_{2}x\tag {3A}\\ c_{2} & =\lim _{y^{\prime }\rightarrow y_{0}^{\prime }}\lim _{x\rightarrow x_{0}}\frac {y^{\prime }-c_{1}x}{x^{2}} \tag {4A}\end{align}

So we end up with 4 equations (1A,2A,3A,4A) with 2 unknowns to solve for \(c_{1},c_{2}\). This is OK. If the system is valid, there will be a solution for \(c_{1},c_{2}\) found.

This secondary algorithm is only used if the main algorithm does not work. Here an example using the secondary algorithm for second order ode.