2.1.38 problem 38
Internal
problem
ID
[8521]
Book
:
Second
order
enumerated
odes
Section
:
section
1
Problem
number
:
38
Date
solved
:
Sunday, November 10, 2024 at 03:58:54 AM
CAS
classification
:
[[_2nd_order, _missing_x]]
Solve
\begin{align*} y^{\prime \prime }+y&=1 \end{align*}
Solved as second order linear constant coeff ode
Time used: 0.116 (sec)
This is second order non-homogeneous ODE. In standard form the ODE is
\[ A y''(x) + B y'(x) + C y(x) = f(x) \]
Where \(A=1, B=0, C=1, f(x)=1\) .
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 }+y = 0 \]
This is second
order with constant coefficients homogeneous ODE. In standard form the ODE is
\[ A y''(x) + B y'(x) + C y(x) = 0 \]
Where in the above \(A=1, B=0, C=1\) . Let the solution be \(y=e^{\lambda x}\) . Substituting this into the ODE gives
\[ \lambda ^{2} {\mathrm e}^{x \lambda }+{\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}+1 = 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=1\) 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 (1\right )}\\ &= \pm i \end{align*}
Hence
\begin{align*} \lambda _1 &= + i\\ \lambda _2 &= - i \end{align*}
Which simplifies to
\begin{align*}
\lambda _1 &= i \\
\lambda _2 &= -i \\
\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 =1\) . Therefore the final solution, when using Euler relation, can be
written as
\[
y = e^{\alpha x} \left ( c_1 \cos (\beta x) + c_2 \sin (\beta x) \right )
\]
Which becomes
\[
y = e^{0}\left (c_1 \cos \left (x \right )+c_2 \sin \left (x \right )\right )
\]
Or
\[
y = c_1 \cos \left (x \right )+c_2 \sin \left (x \right )
\]
Therefore the homogeneous solution \(y_h\) is
\[
y_h = c_1 \cos \left (x \right )+c_2 \sin \left (x \right )
\]
The
particular solution is now found using the method of undetermined coefficients.
Looking at the RHS of the ode, which is
\[ 1 \]
Shows that the corresponding undetermined
set of the basis functions (UC_set) for the trial solution is
\[ [\{1\}] \]
While the set of the
basis functions for the homogeneous solution found earlier is
\[ \{\cos \left (x \right ), \sin \left (x \right )\} \]
Since there is no
duplication between the basis function in the UC_set and the basis functions of the
homogeneous solution, the trial solution is a linear combination of all the basis in the
UC_set.
\[
y_p = A_{1}
\]
The unknowns \(\{A_{1}\}\) are found by substituting the above trial solution \(y_p\) into the
ODE and comparing coefficients. Substituting the trial solution into the ODE
and simplifying gives
\[
A_{1} = 1
\]
Solving for the unknowns by comparing coefficients results
in
\[ [A_{1} = 1] \]
Substituting the above back in the above trial solution \(y_p\) , gives the particular
solution
\[
y_p = 1
\]
Therefore the general solution is
\begin{align*}
y &= y_h + y_p \\
&= \left (c_1 \cos \left (x \right )+c_2 \sin \left (x \right )\right ) + \left (1\right ) \\
\end{align*}
Will add steps showing solving for IC
soon.
Summary of solutions found
\begin{align*}
y &= 1+c_1 \cos \left (x \right )+c_2 \sin \left (x \right ) \\
\end{align*}
Figure 2.130: Slope field plot
\(y^{\prime \prime }+y = 1\)
Solved as second order can be made integrable
Time used: 0.824 (sec)
Multiplying the ode by \(y^{\prime }\) gives
\[ y^{\prime } y^{\prime \prime }+y^{\prime } y-y^{\prime } = 0 \]
Integrating the above w.r.t \(x\) gives
\begin{align*} \int \left (y^{\prime } y^{\prime \prime }+y^{\prime } y-y^{\prime }\right )d x &= 0 \\ \frac {{y^{\prime }}^{2}}{2}+\frac {y^{2}}{2}-y &= c_1 \end{align*}
Which is now solved for \(y\) . Solving for the derivative gives these ODE’s to solve
\begin{align*}
\tag{1} y^{\prime }&=\sqrt {-y^{2}+2 y+2 c_1} \\
\tag{2} y^{\prime }&=-\sqrt {-y^{2}+2 y+2 c_1} \\
\end{align*}
Now each of
the above is solved separately.
Solving Eq. (1)
Integrating gives
\begin{align*} \int \frac {1}{\sqrt {-y^{2}+2 c_1 +2 y}}d y &= dx\\ \arctan \left (\frac {y -1}{\sqrt {-y^{2}+2 c_1 +2 y}}\right )&= x +c_2 \end{align*}
Singular solutions are found by solving
\begin{align*} \sqrt {-y^{2}+2 c_1 +2 y}&= 0 \end{align*}
for \(y\) . This is because we had to divide by this in the above step. This gives the following
singular solution(s), which also have to satisfy the given ODE.
\begin{align*} y = 1+\sqrt {1+2 c_1}\\ y = 1-\sqrt {1+2 c_1} \end{align*}
Solving for \(y\) gives
\begin{align*}
y &= \tan \left (x +c_2 \right ) \sqrt {\frac {1+2 c_1}{\tan \left (x +c_2 \right )^{2}+1}}+1 \\
\end{align*}
Solving Eq. (2)
Integrating gives
\begin{align*} \int -\frac {1}{\sqrt {-y^{2}+2 c_1 +2 y}}d y &= dx\\ -\arctan \left (\frac {y -1}{\sqrt {-y^{2}+2 c_1 +2 y}}\right )&= x +c_3 \end{align*}
Singular solutions are found by solving
\begin{align*} -\sqrt {-y^{2}+2 c_1 +2 y}&= 0 \end{align*}
for \(y\) . This is because we had to divide by this in the above step. This gives the following
singular solution(s), which also have to satisfy the given ODE.
\begin{align*} y = 1+\sqrt {1+2 c_1}\\ y = 1-\sqrt {1+2 c_1} \end{align*}
Solving for \(y\) gives
\begin{align*}
y &= -\tan \left (x +c_3 \right ) \sqrt {\frac {1+2 c_1}{\tan \left (x +c_3 \right )^{2}+1}}+1 \\
\end{align*}
Will add steps showing solving for IC soon.
The solution
\[
y = 1-\sqrt {1+2 c_1}
\]
was found not to satisfy the ode or the IC. Hence it is removed. The solution
\[
y = 1+\sqrt {1+2 c_1}
\]
was found not to satisfy the ode or the IC. Hence it is removed.
Summary of solutions found
\begin{align*}
y &= \tan \left (x +c_2 \right ) \sqrt {\frac {1+2 c_1}{\tan \left (x +c_2 \right )^{2}+1}}+1 \\
y &= -\tan \left (x +c_3 \right ) \sqrt {\frac {1+2 c_1}{\tan \left (x +c_3 \right )^{2}+1}}+1 \\
\end{align*}
Figure 2.131: Slope field plot
\(y^{\prime \prime }+y = 1\)
Solved as second order ode using Kovacic algorithm
Time used: 0.106 (sec)
Writing the ode as
\begin{align*} y^{\prime \prime }+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 &= 0\tag {3} \\ C &= 1 \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 {-1}{1}\tag {6} \end{align*}
Comparing the above to (5) shows that
\begin{align*} s &= -1\\ t &= 1 \end{align*}
Therefore eq. (4) becomes
\begin{align*} z''(x) &= -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 2.23: 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 = -1\) 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 (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
\[
y_1 = z_1 e^{ \int -\frac {1}{2} \frac {B}{A} \,dx}
\]
Since \(B=0\) then the above reduces to
\begin{align*}
y_1 &= z_1 \\
&= \cos \left (x \right ) \\
\end{align*}
Which simplifies to
\[
y_1 = \cos \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 \]
Since \(B=0\) then the above becomes
\begin{align*}
y_2 &= y_1 \int \frac {1}{y_1^2} \,dx \\
&= \cos \left (x \right )\int \frac {1}{\cos \left (x \right )^{2}} \,dx \\
&= \cos \left (x \right )\left (\tan \left (x \right )\right ) \\
\end{align*}
Therefore the solution
is
\begin{align*}
y &= c_1 y_1 + c_2 y_2 \\
&= c_1 \left (\cos \left (x \right )\right ) + c_2 \left (\cos \left (x \right )\left (\tan \left (x \right )\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 }+y = 0
\]
The homogeneous solution is found using the Kovacic algorithm which results in
\[
y_h = c_1 \cos \left (x \right )+c_2 \sin \left (x \right )
\]
The particular solution is now found using the method of undetermined coefficients.
Looking at the RHS of the ode, which is
\[ 1 \]
Shows that the corresponding undetermined
set of the basis functions (UC_set) for the trial solution is
\[ [\{1\}] \]
While the set of the
basis functions for the homogeneous solution found earlier is
\[ \{\cos \left (x \right ), \sin \left (x \right )\} \]
Since there is no
duplication between the basis function in the UC_set and the basis functions of the
homogeneous solution, the trial solution is a linear combination of all the basis in the
UC_set.
\[
y_p = A_{1}
\]
The unknowns \(\{A_{1}\}\) are found by substituting the above trial solution \(y_p\) into the
ODE and comparing coefficients. Substituting the trial solution into the ODE
and simplifying gives
\[
A_{1} = 1
\]
Solving for the unknowns by comparing coefficients results
in
\[ [A_{1} = 1] \]
Substituting the above back in the above trial solution \(y_p\) , gives the particular
solution
\[
y_p = 1
\]
Therefore the general solution is
\begin{align*}
y &= y_h + y_p \\
&= \left (c_1 \cos \left (x \right )+c_2 \sin \left (x \right )\right ) + \left (1\right ) \\
\end{align*}
Will add steps showing solving for IC
soon.
Summary of solutions found
\begin{align*}
y &= 1+c_1 \cos \left (x \right )+c_2 \sin \left (x \right ) \\
\end{align*}
Figure 2.132: Slope field plot
\(y^{\prime \prime }+y = 1\)
Solved as second order ode adjoint method
Time used: 0.725 (sec)
In normal form the ode
\begin{align*} y^{\prime \prime }+y = 1 \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 )&=0\\ q \left (x \right )&=1\\ r \left (x \right )&=1 \end{align*}
The Lagrange adjoint ode is given by
\begin{align*} \xi ^{''}-(\xi \, p)'+\xi q &= 0\\ \xi ^{''}-\left (0\right )' + \left (\xi \left (x \right )\right ) &= 0\\ \xi ^{\prime \prime }\left (x \right )+\xi \left (x \right )&= 0 \end{align*}
Which is solved for \(\xi (x)\) . This is second order with constant coefficients homogeneous ODE. In
standard form the ODE is
\[ A \xi ''(x) + B \xi '(x) + C \xi (x) = 0 \]
Where in the above \(A=1, B=0, C=1\) . Let the solution be \(\xi =e^{\lambda x}\) . Substituting this into
the ODE gives
\[ \lambda ^{2} {\mathrm e}^{x \lambda }+{\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}+1 = 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=1\) 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 (1\right )}\\ &= \pm i \end{align*}
Hence
\begin{align*} \lambda _1 &= + i\\ \lambda _2 &= - i \end{align*}
Which simplifies to
\begin{align*}
\lambda _1 &= i \\
\lambda _2 &= -i \\
\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 =1\) . Therefore the final solution, when using Euler relation,
can be written as
\[
\xi = e^{\alpha x} \left ( c_1 \cos (\beta x) + c_2 \sin (\beta x) \right )
\]
Which becomes
\[
\xi = e^{0}\left (c_1 \cos \left (x \right )+c_2 \sin \left (x \right )\right )
\]
Or
\[
\xi = c_1 \cos \left (x \right )+c_2 \sin \left (x \right )
\]
Will add steps showing solving for IC
soon.
The original ode 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 )} \end{align*}
Or
\begin{align*} y^{\prime }-\frac {y \left (-c_1 \sin \left (x \right )+c_2 \cos \left (x \right )\right )}{c_1 \cos \left (x \right )+c_2 \sin \left (x \right )}&=\frac {c_1 \sin \left (x \right )-c_2 \cos \left (x \right )}{c_1 \cos \left (x \right )+c_2 \sin \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 {c_1 \sin \left (x \right )-c_2 \cos \left (x \right )}{c_1 \cos \left (x \right )+c_2 \sin \left (x \right )}\\ p(x) &=-\frac {-c_1 \sin \left (x \right )+c_2 \cos \left (x \right )}{c_1 \cos \left (x \right )+c_2 \sin \left (x \right )} \end{align*}
The integrating factor \(\mu \) is
\begin{align*} \mu &= e^{\int {q\,dx}}\\ &= {\mathrm e}^{\int \frac {c_1 \sin \left (x \right )-c_2 \cos \left (x \right )}{c_1 \cos \left (x \right )+c_2 \sin \left (x \right )}d x}\\ &= \frac {1}{c_1 \cos \left (x \right )+c_2 \sin \left (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 {-c_1 \sin \left (x \right )+c_2 \cos \left (x \right )}{c_1 \cos \left (x \right )+c_2 \sin \left (x \right )}\right ) \\
\frac {\mathop {\mathrm {d}}}{ \mathop {\mathrm {d}x}} \left (\frac {y}{c_1 \cos \left (x \right )+c_2 \sin \left (x \right )}\right ) &= \left (\frac {1}{c_1 \cos \left (x \right )+c_2 \sin \left (x \right )}\right ) \left (-\frac {-c_1 \sin \left (x \right )+c_2 \cos \left (x \right )}{c_1 \cos \left (x \right )+c_2 \sin \left (x \right )}\right ) \\
\mathrm {d} \left (\frac {y}{c_1 \cos \left (x \right )+c_2 \sin \left (x \right )}\right ) &= \left (-\frac {-c_1 \sin \left (x \right )+c_2 \cos \left (x \right )}{\left (c_1 \cos \left (x \right )+c_2 \sin \left (x \right )\right )^{2}}\right )\, \mathrm {d} x \\
\end{align*}
Integrating gives
\begin{align*} \frac {y}{c_1 \cos \left (x \right )+c_2 \sin \left (x \right )}&= \int {-\frac {-c_1 \sin \left (x \right )+c_2 \cos \left (x \right )}{\left (c_1 \cos \left (x \right )+c_2 \sin \left (x \right )\right )^{2}} \,dx} \\ &=\frac {1}{c_1 \cos \left (x \right )+c_2 \sin \left (x \right )} + c_3 \end{align*}
Dividing throughout by the integrating factor \(\frac {1}{c_1 \cos \left (x \right )+c_2 \sin \left (x \right )}\) gives the final solution
\[ y = \sin \left (x \right ) c_2 c_3 +\cos \left (x \right ) c_1 c_3 +1 \]
Hence, the solution
found using Lagrange adjoint equation method is
\begin{align*}
y &= \sin \left (x \right ) c_2 c_3 +\cos \left (x \right ) c_1 c_3 +1 \\
\end{align*}
The constants can be merged to give
\[
y = 1+c_1 \cos \left (x \right )+c_2 \sin \left (x \right )
\]
Will
add steps showing solving for IC soon.
Summary of solutions found
\begin{align*}
y &= 1+c_1 \cos \left (x \right )+c_2 \sin \left (x \right ) \\
\end{align*}
Figure 2.133: Slope field plot
\(y^{\prime \prime }+y = 1\)
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 )=1 \\ \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 )=1\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 )d x \right )+\sin \left (x \right ) \left (\int \cos \left (x \right )d x \right ) \\ {} & \circ & \textrm {Compute integrals}\hspace {3pt} \\ {} & {} & y_{p}\left (x \right )=1 \\ \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 )+1 \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.005
(sec)
Leaf size : 14
dsolve ( diff ( diff ( y ( x ), x ), x )+ y ( x ) = 1,
y(x),singsol=all)
\[
y = \cos \left (x \right ) c_{1} +\sin \left (x \right ) c_{2} +1
\]
Mathematica DSolve solution
Solving time : 0.012
(sec)
Leaf size : 17
DSolve [{ D [ y [ x ],{ x ,2}]+ y [ x ]==1,{}},
y[x],x,IncludeSingularSolutions-> True ]
\[
y(x)\to c_1 \cos (x)+c_2 \sin (x)+1
\]