Numerical solution of the Volterra equation with an exponential factor 
Given : $$u(x)=x+2 \int_0^x e^{x-t}u(t)dt$$
Solve the Volterra Equation numerically using Trapezoidal Rule in $(0,5)$ choosing $n=8$ and compare with the exact values.

The Exact Solution I have found is : $$u(x)=x+\dfrac{2}{9}e^{3x}[1-e^{-3x}(3x+1)]$$
Numerically solving I have got :

Both look  disastrous. So can anyone show me where it is wrong or if possible provide solution.
 A: The equation includes an exponential which produces very important variation of $u(x)$. So, is not surprising to observe "disastrous" results (as you say) if the number $n$ of intervals is too low.
Probably, the very small number $n=8$ was chosen in order to have only a few numbers to compare , respectively those given in the book and those computed by the student.
May be, one aim of the exercice is to make aware of the importance of the deviations due to a too low number of intervals.
The table below shows how the accuracy of the results becomes better, just by increassing $n$. That way, one can obtain results closed to the theoretical values.
 
A: Trapezoidal rule of $\int^b_a f(x) dx$ with $n$ subintervals:
$$\frac{b-a}{2n}(f(x_0)+2f(x_1)+2f(x_2)+...+2f(x_{n-1})+f(x_n))$$
To get your textbook answer, notice that the length of your subinterval is $\frac{5}{8}$:
$$u(0)=0$$
$$u(5/8)=5/8+2\cdot \frac{5/8}{2}(e^{5/8-0}u(0)+e^{5/8-5/8}u(5/8))$$
This gives you $u(5/8)==1.666667$
$$u(5/4)=5/4+2\cdot \frac{5/4}{4}(e^{5/4-0}u(0)+2e^{5/4-5/8}u(5/8)+e^{5/4-5/4}u(5/4))$$
This would give you $u(5/4)=13.7124$. The following ones are similar.
I think the purpose of this problem is to show you it does not work. It will need some regularization to numerically solve the volterra equation. 
