**This project counts 20% of the final grade!**. It is strongly recommended that you start early, and don't
wait until the last couple of days.

Due: Monday, March 14, in class, or earlier (**Note: No late submissions !!**)

In this assignment, you are asked to numerically differentiate and integrate a function. For this purpose, we
generate points between the boundaries a=0.2, and b=5.0. We generate these points at the top of the code considering
the function

f(x) = x^2 * log(x)

where log(x) is the logarithm to the basis e (and not 10). We then pretend for a while that we don't know the function
(unless you are asked specifically to use the analytic expression for the derivative and the integral.) We do everything
for stepsizes h=0.1, and h=0.2. (So there are 49 and 25 points).

Write all codes as general as possible; i.e., specify a, b, h, number of steps at the top (with proper variables),
and then use these variables. You will have to use loops. Make sure you have the correct expressions at the endpoints.
Do not code a loop for i=1,100; instead, use something like for i=1,nmax.

Write a code that differentiates this function. Always use the most appropriate 3-point formula (page 170, textbook).

a) (20%) Use stepsize h=0.1. Plot your result for the derivative of f (as a function of x) . Repeat with a stepsize
of h=0.2.

b) (10%) Since f(x) is given, you can get an analytic expression for the derivative of f. Compare the results with
the results from a).

c) (20%) The error in the approximation can now be calculated from a) and b) as the difference. Compare the error
with the error you can calculate from the error formula. Do this comparison for each node. Give a plot that compares
the actual error with the estimated error (i.e., plot actual error, and estimated error as a function of x, or
node). Do this for both stepsizes (h=0.1, h=0.2). Compare the results.

d)(10%): Implement an extrapolation formula to get a higher order method. Use the following formula:

M = N(h/2) + [N(h/2) - N(h)]/3 ,

where N is the appropriate 3-point formula. This formula is an O(h^{4}) expression. It will (has been)
derived in homework #8. Use h=0.2, h/2=0.1. Be particularly careful with the expressions at the endpoints!

Integrate this function (from 0.2 to 5.0). Write codes with a stepsize of h=0.1 that use

a) the Composite Simpson's rule

b) the Composite Trapezoidal rule

c) the Composite Midpoint rule

d) The analytic expression for the integral is

F(x) = x^3 * [log(x)/3 - 1/9]

Compare the results from a) - c) with the exact result.

e) Repeat a) - d) for h=0.2; compare the results!

Work through section 4.6 of the textbook (Adaptive quadature methods).

Write a code to implement adaptive quadrature, using Simpson's rule.

Solve textbook problem 3.(a) (Section 4.6), using your adaptive code. How many nodes (and thus, function evaluations)
did you need to get the required accuracy ? How many function evaluation would you have needed (approximately),
if you had used a regular composite Simpson's rule ? (i.e., you have to solve the problem also using the Composite
Simpson's rule from above, for a different number of values for h).

**Please Note:** This bonus problem is hard; I expect that it will take (at least) as long as the rest of this
assignment. It is mainly intended for those of you who really would like to write more challenging code, and/or
those who really want/need some extra credit (the bonus problem counts almost as much as two homework assignments).

- The codes you wrote for problem 1 and 2. Should be one code for differentiation unsing the three-point formulas, one for differentiation using the extrapolation formula, and one code for integration (you can do all rules in one code). If you do the bonus problem, turn in this code as well.
- Two plots (one for each value of h) of derivative of f as function of x, approximated and exact ( 1a) and 1b)
- Two plots (one for each value of h) of the actual and estimated error as a function of x ( 1c).
- A plot of actual error using the extrapolation formula (and comparison to the actual error using the 3 point formula, with h=0.1).
- The actual numbers (results) for problem 2.
- A discussion of the comparison ((2d) and (2e)).