5.38 problem 42

Internal problem ID [14267]

Book: INTRODUCTORY DIFFERENTIAL EQUATIONS. Martha L. Abell, James P. Braselton. Fourth edition 2014. ElScAe. 2014
Section: Chapter 2. First Order Equations. Exercises 2.3, page 49
Problem number: 42.
ODE order: 1.
ODE degree: 1.

CAS Maple gives this as type [[_linear, `class A`]]

\[ \boxed {y^{\prime }+y=\left \{\begin {array}{cc} 4 & 0\le t <2 \\ 0 & 2\le t \end {array}\right .} \] With initial conditions \begin {align*} [y \left (0\right ) = 0] \end {align*}

Solution by Maple

Time used: 0.422 (sec). Leaf size: 38

dsolve([diff(y(t),t)+y(t)=piecewise(0<=t and t<2,4,t>=2,0),y(0) = 0],y(t), singsol=all)
 

\[ y \left (t \right ) = \left \{\begin {array}{cc} 0 & t <0 \\ 4-4 \,{\mathrm e}^{-t} & t <2 \\ 4 \,{\mathrm e}^{2-t}-4 \,{\mathrm e}^{-t} & 2\le t \end {array}\right . \]

Solution by Mathematica

Time used: 0.061 (sec). Leaf size: 40

DSolve[{y'[t]+y[t]==Piecewise[{{4,0<=t<2},{0,t>=2}}],{y[0]==0}},y[t],t,IncludeSingularSolutions -> True]
 

\[ y(t)\to \begin {array}{cc} \{ & \begin {array}{cc} 0 & t\leq 0 \\ 4-4 e^{-t} & 0<t\leq 2 \\ 4 e^{-t} \left (-1+e^2\right ) & \text {True} \\ \end {array} \\ \end {array} \]