5.30 problem 30

Internal problem ID [11667]

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

CAS Maple gives this as type [_linear]

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

Solution by Maple

Time used: 0.265 (sec). Leaf size: 31

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

\[ y \left (x \right ) = \frac {\left \{\begin {array}{cc} 8 & x <0 \\ x^{2}+8 & x <2 \\ 4+4 x & 2\le x \end {array}\right .}{x +2} \]

Solution by Mathematica

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

DSolve[{(x+2)*y'[x]+y[x]==Piecewise[{{2*x,0<=x<2},{4,x>=2}}],{y[0]==4}},y[x],x,IncludeSingularSolutions -> True]
 

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