5.29 problem 29

Internal problem ID [11666]

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: 29.
ODE order: 1.
ODE degree: 1.

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

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

Solution by Maple

Time used: 0.359 (sec). Leaf size: 35

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

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

Solution by Mathematica

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

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

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