14.6 problem Problem 32

14.6.1 Existence and uniqueness analysis
14.6.2 Solving as laplace ode
14.6.3 Maple step by step solution

Internal problem ID [2872]
Internal file name [OUTPUT/2364_Sunday_June_05_2022_03_00_59_AM_2867957/index.tex]

Book: Differential equations and linear algebra, Stephen W. Goode and Scott A Annin. Fourth edition, 2015
Section: Chapter 10, The Laplace Transform and Some Elementary Applications. Exercises for 10.7. page 704
Problem number: Problem 32.
ODE order: 1.
ODE degree: 1.

The type(s) of ODE detected by this program : "linear", "first_order_ode_lie_symmetry_lookup"

Maple gives the following as the ode type

[[_linear, `class A`]]

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

14.6.1 Existence and uniqueness analysis

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

Where here \begin {align*} p(t) &=-3\\ q(t) &=\left \{\begin {array}{cc} \sin \left (t \right ) & 0\le t <\frac {\pi }{2} \\ 1 & \frac {\pi }{2}\le t \end {array}\right . \end {align*}

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

The domain of \(p(t)=-3\) is \[ \{-\infty

14.6.2 Solving as laplace ode

Solving using the Laplace transform method. Let \[ \mathcal {L}\left (y\right ) =Y(s) \] 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 ) \end {align*}

The given ode now becomes an algebraic equation in the Laplace domain \begin {align*} s Y \left (s \right )-y \left (0\right )-3 Y \left (s \right ) = \frac {{\mathrm e}^{-\frac {s \pi }{2}}+s}{\left (s^{2}+1\right ) s}\tag {1} \end {align*}

Replacing initial condition gives \begin {align*} s Y \left (s \right )-2-3 Y \left (s \right ) = \frac {{\mathrm e}^{-\frac {s \pi }{2}}+s}{\left (s^{2}+1\right ) s} \end {align*}

Solving for \(Y(s)\) gives \begin {align*} Y(s) = \frac {2 s^{3}+{\mathrm e}^{-\frac {s \pi }{2}}+3 s}{\left (s^{2}+1\right ) s \left (s -3\right )} \end {align*}

Taking the inverse Laplace transform gives \begin {align*} y&= \mathcal {L}^{-1}\left (Y(s)\right )\\ &= \mathcal {L}^{-1}\left (\frac {2 s^{3}+{\mathrm e}^{-\frac {s \pi }{2}}+3 s}{\left (s^{2}+1\right ) s \left (s -3\right )}\right )\\ &= -\frac {\operatorname {Heaviside}\left (t -\frac {\pi }{2}\right )}{3}+\frac {21 \,{\mathrm e}^{3 t}}{10}+\frac {{\mathrm e}^{-\frac {3 \pi }{2}+3 t}}{30}-\frac {\operatorname {Heaviside}\left (\frac {\pi }{2}-t \right ) \left (3 \cos \left (t \right )+{\mathrm e}^{-\frac {3 \pi }{2}+3 t}+9 \sin \left (t \right )\right )}{30} \end {align*}

Converting the above solution to piecewise it becomes \[ y = \left \{\begin {array}{cc} \frac {21 \,{\mathrm e}^{3 t}}{10}-\frac {\cos \left (t \right )}{10}-\frac {3 \sin \left (t \right )}{10} & t <\frac {\pi }{2} \\ \frac {21 \,{\mathrm e}^{\frac {3 \pi }{2}}}{10}-\frac {19}{30} & t =\frac {\pi }{2} \\ \frac {21 \,{\mathrm e}^{3 t}}{10}+\frac {{\mathrm e}^{-\frac {3 \pi }{2}+3 t}}{30}-\frac {1}{3} & \frac {\pi }{2}

Summary

The solution(s) found are the following \begin{align*} \tag{1} y &= \left \{\begin {array}{cc} \frac {21 \,{\mathrm e}^{3 t}}{10}-\frac {\cos \left (t \right )}{10}-\frac {3 \sin \left (t \right )}{10} & t <\frac {\pi }{2} \\ \frac {21 \,{\mathrm e}^{\frac {3 \pi }{2}}}{10}-\frac {19}{30} & t &=\frac {\pi }{2} \\ \frac {21 \,{\mathrm e}^{3 t}}{10}+\frac {{\mathrm e}^{-\frac {3 \pi }{2}+3 t}}{30}-\frac {1}{3} & \frac {\pi }{2}

Verification of solutions

\[ y = \left \{\begin {array}{cc} \frac {21 \,{\mathrm e}^{3 t}}{10}-\frac {\cos \left (t \right )}{10}-\frac {3 \sin \left (t \right )}{10} & t <\frac {\pi }{2} \\ \frac {21 \,{\mathrm e}^{\frac {3 \pi }{2}}}{10}-\frac {19}{30} & t =\frac {\pi }{2} \\ \frac {21 \,{\mathrm e}^{3 t}}{10}+\frac {{\mathrm e}^{-\frac {3 \pi }{2}+3 t}}{30}-\frac {1}{3} & \frac {\pi }{2}

14.6.3 Maple step by step solution

\[ \begin {array}{lll} & {} & \textrm {Let's solve}\hspace {3pt} \\ {} & {} & \left [y^{\prime }-3 y=\left \{\begin {array}{cc} \sin \left (t \right ) & 0\le t <\frac {\pi }{2} \\ 1 & \frac {\pi }{2}\le t \end {array}\right ., y \left (0\right )=2\right ] \\ \bullet & {} & \textrm {Highest derivative means the order of the ODE is}\hspace {3pt} 1 \\ {} & {} & y^{\prime } \\ \bullet & {} & \textrm {Solve for the highest derivative}\hspace {3pt} \\ {} & {} & y^{\prime }=3 y+\left \{\begin {array}{cc} \sin \left (t \right ) & 0\le t <\frac {\pi }{2} \\ 1 & \frac {\pi }{2}\le t \end {array}\right . \\ \bullet & {} & \textrm {Group terms with}\hspace {3pt} y\hspace {3pt}\textrm {on the lhs of the ODE and the rest on the rhs of the ODE}\hspace {3pt} \\ {} & {} & y^{\prime }-3 y=\left \{\begin {array}{cc} \sin \left (t \right ) & 0\le t <\frac {\pi }{2} \\ 1 & \frac {\pi }{2}\le t \end {array}\right . \\ \bullet & {} & \textrm {The ODE is linear; multiply by an integrating factor}\hspace {3pt} \mu \left (t \right ) \\ {} & {} & \mu \left (t \right ) \left (y^{\prime }-3 y\right )=\mu \left (t \right ) \left (\left \{\begin {array}{cc} \sin \left (t \right ) & 0\le t <\frac {\pi }{2} \\ 1 & \frac {\pi }{2}\le t \end {array}\right .\right ) \\ \bullet & {} & \textrm {Assume the lhs of the ODE is the total derivative}\hspace {3pt} \frac {d}{d t}\left (y \mu \left (t \right )\right ) \\ {} & {} & \mu \left (t \right ) \left (y^{\prime }-3 y\right )=y^{\prime } \mu \left (t \right )+y \mu ^{\prime }\left (t \right ) \\ \bullet & {} & \textrm {Isolate}\hspace {3pt} \mu ^{\prime }\left (t \right ) \\ {} & {} & \mu ^{\prime }\left (t \right )=-3 \mu \left (t \right ) \\ \bullet & {} & \textrm {Solve to find the integrating factor}\hspace {3pt} \\ {} & {} & \mu \left (t \right )={\mathrm e}^{-3 t} \\ \bullet & {} & \textrm {Integrate both sides with respect to}\hspace {3pt} t \\ {} & {} & \int \left (\frac {d}{d t}\left (y \mu \left (t \right )\right )\right )d t =\int \mu \left (t \right ) \left (\left \{\begin {array}{cc} \sin \left (t \right ) & 0\le t <\frac {\pi }{2} \\ 1 & \frac {\pi }{2}\le t \end {array}\right .\right )d t +c_{1} \\ \bullet & {} & \textrm {Evaluate the integral on the lhs}\hspace {3pt} \\ {} & {} & y \mu \left (t \right )=\int \mu \left (t \right ) \left (\left \{\begin {array}{cc} \sin \left (t \right ) & 0\le t <\frac {\pi }{2} \\ 1 & \frac {\pi }{2}\le t \end {array}\right .\right )d t +c_{1} \\ \bullet & {} & \textrm {Solve for}\hspace {3pt} y \\ {} & {} & y=\frac {\int \mu \left (t \right ) \left (\left \{\begin {array}{cc} \sin \left (t \right ) & 0\le t <\frac {\pi }{2} \\ 1 & \frac {\pi }{2}\le t \end {array}\right .\right )d t +c_{1}}{\mu \left (t \right )} \\ \bullet & {} & \textrm {Substitute}\hspace {3pt} \mu \left (t \right )={\mathrm e}^{-3 t} \\ {} & {} & y=\frac {\int {\mathrm e}^{-3 t} \left (\left \{\begin {array}{cc} \sin \left (t \right ) & 0\le t <\frac {\pi }{2} \\ 1 & \frac {\pi }{2}\le t \end {array}\right .\right )d t +c_{1}}{{\mathrm e}^{-3 t}} \\ \bullet & {} & \textrm {Evaluate the integrals on the rhs}\hspace {3pt} \\ {} & {} & y=\frac {\left \{\begin {array}{cc} 0 & t \le 0 \\ -\frac {{\mathrm e}^{-3 t} \cos \left (t \right )}{10}-\frac {3 \,{\mathrm e}^{-3 t} \sin \left (t \right )}{10}+\frac {1}{10} & t \le \frac {\pi }{2} \\ -\frac {{\mathrm e}^{-3 t}}{3}+\frac {1}{10}+\frac {{\mathrm e}^{-\frac {3 \pi }{2}}}{30} & \frac {\pi }{2}

Maple trace

`Methods for first order ODEs: 
--- Trying classification methods --- 
trying a quadrature 
trying 1st order linear 
<- 1st order linear successful`
 

Solution by Maple

Time used: 3.703 (sec). Leaf size: 61

dsolve([diff(y(t),t)-3*y(t)=piecewise(0<=t and t<Pi/2,sin(t),t>=Pi/2,1),y(0) = 2],y(t), singsol=all)
 

\[ y \left (t \right ) = \frac {\left (\left \{\begin {array}{cc} 21 \,{\mathrm e}^{3 t}-\cos \left (t \right )-3 \sin \left (t \right ) & t <\frac {\pi }{2} \\ -\frac {19}{3}+21 \,{\mathrm e}^{\frac {3 \pi }{2}} & t =\frac {\pi }{2} \\ 21 \,{\mathrm e}^{3 t}+\frac {{\mathrm e}^{3 t -\frac {3 \pi }{2}}}{3}-\frac {10}{3} & \frac {\pi }{2}

Solution by Mathematica

Time used: 0.1 (sec). Leaf size: 68

DSolve[{y'[t]-3*y[t]==Piecewise[{{Sin[t],0<=t<Pi/2},{1,t >= Pi/2}}],{y[0]==2}},y[t],t,IncludeSingularSolutions -> True]
 

\[ y(t)\to \begin {array}{cc} \{ & \begin {array}{cc} 2 e^{3 t} & t\leq 0 \\ \frac {1}{30} \left (-10+63 e^{3 t}+e^{3 t-\frac {3 \pi }{2}}\right ) & 2 t>\pi \\ \frac {1}{10} \left (-\cos (t)+21 e^{3 t}-3 \sin (t)\right ) & \text {True} \\ \end {array} \\ \end {array} \]