15.5 problem 4 (e)

15.5.1 Existence and uniqueness analysis
15.5.2 Maple step by step solution

Internal problem ID [12810]
Internal file name [OUTPUT/11463_Saturday_November_04_2023_08_47_26_AM_12715766/index.tex]

Book: Ordinary Differential Equations by Charles E. Roberts, Jr. CRC Press. 2010
Section: Chapter 5. The Laplace Transform Method. Exercises 5.4, page 265
Problem number: 4 (e).
ODE order: 2.
ODE degree: 1.

The type(s) of ODE detected by this program : "second_order_laplace", "second_order_linear_constant_coeff"

Maple gives the following as the ode type

[[_2nd_order, _linear, _nonhomogeneous]]

\[ \boxed {y^{\prime \prime }+4 y=\left \{\begin {array}{cc} 0 & 0\le x <\pi \\ -\sin \left (3 x \right ) & \pi \le x \end {array}\right .} \] With initial conditions \begin {align*} [y \left (0\right ) = 1, y^{\prime }\left (0\right ) = 1] \end {align*}

15.5.1 Existence and uniqueness analysis

This is a linear ODE. In canonical form it is written as \begin {align*} y^{\prime \prime } + p(x)y^{\prime } + q(x) y &= F \end {align*}

Where here \begin {align*} p(x) &=0\\ q(x) &=4\\ F &=-\left (\left \{\begin {array}{cc} 0 & x <\pi \\ \sin \left (3 x \right ) & \pi \le x \end {array}\right .\right ) \end {align*}

Hence the ode is \begin {align*} y^{\prime \prime }+4 y = -\left (\left \{\begin {array}{cc} 0 & x <\pi \\ \sin \left (3 x \right ) & \pi \le x \end {array}\right .\right ) \end {align*}

The domain of \(p(x)=0\) is \[ \{-\infty

Solving using the Laplace transform method. Let \begin {align*} \mathcal {L}\left (y\right ) =Y(s) \end {align*}

Taking the Laplace transform of the ode and using the relations that \begin {align*} \mathcal {L}\left (y^{\prime }\right ) &= s Y(s) - y \left (0\right )\\ \mathcal {L}\left (y^{\prime \prime }\right ) &= s^2 Y(s) - y'(0) - s y \left (0\right ) \end {align*}

The given ode now becomes an algebraic equation in the Laplace domain \begin {align*} s^{2} Y \left (s \right )-y^{\prime }\left (0\right )-s y \left (0\right )+4 Y \left (s \right ) = \operatorname {laplace} \left (\left \{\begin {array}{cc} 0 & x <\pi \\ -\sin \left (3 x \right ) & \pi \le x \end {array}\right ., x , s\right )\tag {1} \end {align*}

But the initial conditions are \begin {align*} y \left (0\right )&=1\\ y'(0) &=1 \end {align*}

Substituting these initial conditions in above in Eq (1) gives \begin {align*} s^{2} Y \left (s \right )-1-s +4 Y \left (s \right ) = \operatorname {laplace} \left (\left \{\begin {array}{cc} 0 & x <\pi \\ -\sin \left (3 x \right ) & \pi \le x \end {array}\right ., x , s\right ) \end {align*}

Solving the above equation for \(Y(s)\) results in \begin {align*} Y(s) = \frac {\operatorname {laplace} \left (\left \{\begin {array}{cc} 0 & x <\pi \\ -\sin \left (3 x \right ) & \pi \le x \end {array}\right ., x , s\right )+s +1}{s^{2}+4} \end {align*}

Taking the inverse Laplace transform gives \begin {align*} y&= \mathcal {L}^{-1}\left (Y(s)\right )\\ &= \mathcal {L}^{-1}\left (\frac {\operatorname {laplace} \left (\left \{\begin {array}{cc} 0 & x <\pi \\ -\sin \left (3 x \right ) & \pi \le x \end {array}\right ., x , s\right )+s +1}{s^{2}+4}\right )\\ &= \frac {\sin \left (3 x \right )}{5}+\frac {4 \sin \left (2 x \right )}{5}+\cos \left (2 x \right )-\frac {\left (\left \{\begin {array}{cc} 0 & \pi -x <0 \\ 1 & \operatorname {otherwise} \end {array}\right .\right ) \left (3 \sin \left (2 x \right )+2 \sin \left (3 x \right )\right )}{10} \end {align*}

Simplifying the solution gives \[ y = \left \{\begin {array}{cc} \cos \left (2 x \right )+\frac {\sin \left (2 x \right )}{2} & x \le \pi \\ \frac {\left (4 \cos \left (x \right )^{2}+8 \cos \left (x \right )-1\right ) \sin \left (x \right )}{5}+2 \cos \left (x \right )^{2}-1 & \pi

Summary

The solution(s) found are the following \begin{align*} \tag{1} y &= \left \{\begin {array}{cc} \cos \left (2 x \right )+\frac {\sin \left (2 x \right )}{2} & x \le \pi \\ \frac {\left (4 \cos \left (x \right )^{2}+8 \cos \left (x \right )-1\right ) \sin \left (x \right )}{5}+2 \cos \left (x \right )^{2}-1 & \pi

Verification of solutions

\[ y = \left \{\begin {array}{cc} \cos \left (2 x \right )+\frac {\sin \left (2 x \right )}{2} & x \le \pi \\ \frac {\left (4 \cos \left (x \right )^{2}+8 \cos \left (x \right )-1\right ) \sin \left (x \right )}{5}+2 \cos \left (x \right )^{2}-1 & \pi

15.5.2 Maple step by step solution

\[ \begin {array}{lll} & {} & \textrm {Let's solve}\hspace {3pt} \\ {} & {} & \left [y^{\prime \prime }+4 y=\left \{\begin {array}{cc} 0 & x <\pi \\ -\sin \left (3 x \right ) & \pi \le x \end {array}\right ., y \left (0\right )=1, y^{\prime }{\raise{-0.36em}{\Big |}}{\mstack {}{_{\left \{x \hiderel {=}0\right \}}}}=1\right ] \\ \bullet & {} & \textrm {Highest derivative means the order of the ODE is}\hspace {3pt} 2 \\ {} & {} & y^{\prime \prime } \\ \bullet & {} & \textrm {Characteristic polynomial of homogeneous ODE}\hspace {3pt} \\ {} & {} & r^{2}+4=0 \\ \bullet & {} & \textrm {Use quadratic formula to solve for}\hspace {3pt} r \\ {} & {} & r =\frac {0\pm \left (\sqrt {-16}\right )}{2} \\ \bullet & {} & \textrm {Roots of the characteristic polynomial}\hspace {3pt} \\ {} & {} & r =\left (-2 \,\mathrm {I}, 2 \,\mathrm {I}\right ) \\ \bullet & {} & \textrm {1st solution of the homogeneous ODE}\hspace {3pt} \\ {} & {} & y_{1}\left (x \right )=\cos \left (2 x \right ) \\ \bullet & {} & \textrm {2nd solution of the homogeneous ODE}\hspace {3pt} \\ {} & {} & y_{2}\left (x \right )=\sin \left (2 x \right ) \\ \bullet & {} & \textrm {General solution of the ODE}\hspace {3pt} \\ {} & {} & y=c_{1} y_{1}\left (x \right )+c_{2} y_{2}\left (x \right )+y_{p}\left (x \right ) \\ \bullet & {} & \textrm {Substitute in solutions of the homogeneous ODE}\hspace {3pt} \\ {} & {} & y=c_{1} \cos \left (2 x \right )+\sin \left (2 x \right ) c_{2} +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 )=\left \{\begin {array}{cc} 0 & x <\pi \\ -\sin \left (3 x \right ) & \pi \le x \end {array}\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 (2 x \right ) & \sin \left (2 x \right ) \\ -2 \sin \left (2 x \right ) & 2 \cos \left (2 x \right ) \end {array}\right ] \\ {} & \circ & \textrm {Compute Wronskian}\hspace {3pt} \\ {} & {} & W \left (y_{1}\left (x \right ), y_{2}\left (x \right )\right )=2 \\ {} & \circ & \textrm {Substitute functions into equation for}\hspace {3pt} y_{p}\left (x \right ) \\ {} & {} & y_{p}\left (x \right )=-\cos \left (2 x \right ) \left (\int \left (\left \{\begin {array}{cc} 0 & x <\pi \\ -\frac {\cos \left (x \right )}{4}+\frac {\cos \left (5 x \right )}{4} & \pi \le x \end {array}\right .\right )d x \right )+\sin \left (2 x \right ) \left (\int \left (\left \{\begin {array}{cc} 0 & x <\pi \\ -\frac {\sin \left (5 x \right )}{4}-\frac {\sin \left (x \right )}{4} & \pi \le x \end {array}\right .\right )d x \right ) \\ {} & \circ & \textrm {Compute integrals}\hspace {3pt} \\ {} & {} & y_{p}\left (x \right )=\left \{\begin {array}{cc} 0 & x \le \pi \\ \frac {\left (4 \cos \left (x \right )^{2}+3 \cos \left (x \right )-1\right ) \sin \left (x \right )}{5} & \pi

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`
 

Solution by Maple

Time used: 8.188 (sec). Leaf size: 39

dsolve([diff(y(x),x$2)+4*y(x)=piecewise(0<=x and x<Pi,0,Pi<=x,sin(3*(x-Pi))),y(0) = 1, D(y)(0) = 1],y(x), singsol=all)
 

\[ y \left (x \right ) = \cos \left (2 x \right )+\left (\left \{\begin {array}{cc} \frac {\sin \left (2 x \right )}{2} & x <\pi \\ \frac {4 \sin \left (2 x \right )}{5}+\frac {\sin \left (3 x \right )}{5} & \pi \le x \end {array}\right .\right ) \]

Solution by Mathematica

Time used: 0.058 (sec). Leaf size: 42

DSolve[{y''[x]+4*y[x]==Piecewise[{ {0,0<=x<Pi},{Sin[3*(x-Pi)],x>=Pi}}],{y[0]==1,y'[0]==1}},y[x],x,IncludeSingularSolutions -> True]
 

\[ y(x)\to \begin {array}{cc} \{ & \begin {array}{cc} \cos (2 x)+\cos (x) \sin (x) & x\leq \pi \\ \frac {1}{5} (5 \cos (2 x)+4 \sin (2 x)+\sin (3 x)) & \text {True} \\ \end {array} \\ \end {array} \]