14.1.17 problem 17

Internal problem ID [2488]
Book : Differential equations and their applications, 4th ed., M. Braun
Section : Chapter 1. First order differential equations. Section 1.2. Linear equations. Excercises page 9
Problem number : 17
Date solved : Monday, January 27, 2025 at 05:54:09 AM
CAS classification : [[_linear, `class A`]]

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

With initial conditions

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

Solution by Maple

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

dsolve([diff(y(t),t)+y(t)=piecewise(0<=t and t<=1,2,t>1,0),y(0) = 0],y(t), singsol=all)
 
\[ y = \left \{\begin {array}{cc} 0 & t <0 \\ 2-2 \,{\mathrm e}^{-t} & t <1 \\ 2 \,{\mathrm e}^{-t +1}-2 \,{\mathrm e}^{-t} & 1\le t \end {array}\right . \]

Solution by Mathematica

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

DSolve[{D[y[t],t]+y[t]==Piecewise[{{2,0<=t<=2},{0,t>1}}],{y[0]==0}},y[t],t,IncludeSingularSolutions -> True]
 
\[ y(t)\to \begin {array}{cc} \{ & \begin {array}{cc} 0 & t\leq 0 \\ 2-2 e^{-t} & 0<t\leq 2 \\ 2 e^{-t} \left (-1+e^2\right ) & \text {True} \\ \end {array} \\ \end {array} \]