74.5.38 problem 42

Internal problem ID [16002]
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
Date solved : Tuesday, January 28, 2025 at 08:26:13 AM
CAS classification : [[_linear, `class A`]]

\begin{align*} y^{\prime }+y&=\left \{\begin {array}{cc} 4 & 0\le t <2 \\ 0 & 2\le t \end {array}\right . \end{align*}

With initial conditions

\begin{align*} y \left (0\right )&=0 \end{align*}

Solution by Maple

Time used: 0.886 (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 \{\begin {array}{cc} 0 & t <0 \\ 4-4 \,{\mathrm e}^{-t} & t <2 \\ 4 \,{\mathrm e}^{-t +2}-4 \,{\mathrm e}^{-t} & 2\le t \end {array}\right . \]

Solution by Mathematica

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

DSolve[{D[y[t],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} \]