Differential problem solving with Euler and Heun methods I have to write application which solves task presented below. I only know some c# so I will stick to it. It is some kind of homework but I am asking for help with understanding this and advice for implementation. 

Take natural $\ n>=1$ and real $\ a > 1$ 
differential problem 
$\ y'(x) = f(x, y(x)), y(1) = 0$
where $\ f(x,y) = \sqrt{y+1} + x$ 
solve for$\ [1,a]$ with step $\ h = \frac{a-1}{n} $  with Euler and Heun methods.
Compare results with exact solution $\ y(x)=x^2 - 1 $ by finding maximum error of each method.

And I sincerely apologize if I misused some Math terms and if You experience problem with reading my question.
 A: You are being asked to write a program that allows a user to select between the Euler and Heun (Improved Euler) Method and allows the user to input two parameters, $n$ and $a$.
These two parameters affect the output of the program and the results of the calculations.
The Euler Method is given by:
$$y' = f(x, y) = \sqrt{y+1} + x, 1 \le x \le a, y(1) = 0$$
The algorithm to code up is:


*

*Input $a$

*Input $n$

*$h = \dfrac{a - 1}{n}$

*$x_0 = 1$

*$y_0 = 0$

*For $i = 1, 2, \ldots n$

*$~~~~~~~ y_i = y_{i-1} + h f(x_{i-1}, y_{i-1})$

*$~~~~~~~ x_i = 1 + i h$


For example:
$$a = 2, n = 10 \implies h = 0.1, x_0 = 1, y_0 = 0$$
This yields:


*

*$y_1 = y_0 + h f(x_0, y_0) = 0 + 0.1(\sqrt{y_0 + 1} + x_0) = 0.2$

*$x_1 = 1 + 1 \times 0.1 = 1.1$

*$y_2 = y_1 + h f(x_1, y_1) = 0.419545$

*$\ldots$

*$y_{10} = 2.884512$


When you compare this to the actual result, you get:
$$|y_{Exact}(2) - y_{Euler}(2)| = |(2^2 - 1) - 2.884512| = 0.115488.$$
For the Heun Method, you need only change the iteration formula to:
$$y_i = y_{i-1} + \dfrac h4\left(f(x_{i-1}, y_{i-1}) + 3f(x_{i-1}+ \dfrac 23 h, ~~y_{i-1} + \dfrac 23 h f(x_{i-1}, y_{i-1})) \right)$$
Repeating the same example as above, yields:


*

*$y_1 = 0.209772$

*$\ldots$

*$y_{10} = 2.998037$

*Error $= |3 - 2.998037| = 0.001963$ (a much better result).


Of course, you can play around with $a$ and $n$ once you have it coded up and see the impacts of changing those two parameters on the results, which is intended to teach you about numerical algorithms and errors with them. 
Lastly, you need to work the maximum error based on all of the given information and the maximum error of each algorithm and the parameters $a$ and $n$, but I'll leave that to you.
