Solve the integral $$\displaystyle \int_0^4 f(x) \ dx$$ with $$\displaystyle f(x)=\left\{\begin{array}{lll} x+e^x & \mbox{ if } & 0\leq x<2 \\ 3 & \mbox{if} & 2\leq x<3 \\ 2+e^{2x} & \mbox{if} & 3\leq x<4 \end{array}\right.$$
Development:
$$\displaystyle \int_0^2 (x+e^x) \ dx + \int_2^3 3 \ dx + \int_3^4 (2+e^{2x}) \ dx =$$
$$= \Big[\dfrac{x^2}{2}+e^x\Big]^2_0 + [3x]^3_2 + [2x]^4_3 + [\frac{1}{2}e^{2x}]^4_3=$$
$$=(2+e^2-1)+(9-6)+(8-6)+(\frac{1}{2}e^8-\frac{1}{2}e^6)=$$
$$=6+e^2+\frac{1}{2}(e^8-e^6)$$
Solution:
The result is $$6+e^2+\frac{1}{2}(e^8-e^6)$$