5.27 problem 27

Internal problem ID [11664]

Book: Differential Equations by Shepley L. Ross. Third edition. John Willey. New Delhi. 2004.
Section: Chapter 2, section 2.3 (Linear equations). Exercises page 56
Problem number: 27.
ODE order: 1.
ODE degree: 1.

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

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

Solution by Maple

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

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

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

Solution by Mathematica

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

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

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