This web page contains Octave programs that I have developed for interactive demonstrations
and exercises. Click on "Submit to Octave" to run the programs. You can change various parameters
in the codes to experiment with the numerical methods. Note that the lines starting with % are
comments.
The web-based interface to Octave used here is provided courtesy of Prof. Mai Zhou of Dept. of Statistics.
When a figure does not show on your browser, try by clicking the "refresh" button
of the browser.
Exercise 1: The following
plot the graphes of sin(x) and its Taylor polynomials.
You can modify the number of terms used in the Taylor polynomial (n) and the range of
approximation (a and b) to see how they affect
the approximation.
Exercise 2:
The following
involves subtraction of two close numbers a and
b. You can change b by adding more 0s to make it closer to a (e.g.
b=100000/500001) and see what happen. Don't forget to change exact_c as well.
Exercise 3:
The following
implements Newton's
method for 1/(x^2+1 )-1/2=0. Experiment with
different initial value x and the number of iterations to observe
convergence behavior. The graph of the function is given at bottom. It's
also worth trying different equations. Try sin(x) - x =0.
Exercise 4:
The following computes
the interpolating polynomial for a given input of data points. Experiment
different coordinates (x and y) and try more points.
Next interpolation exercise uses points on the graph of sin(x) so that the interpolation approximate sin(x). Experiment different number
of interpolation points. Also compare it with Taylor approximation.
Exercise 5:
The following implements Richardson
extrapolation for approximation f'(x) by
Method 1. (f(x+h)-f(x))/h
Method 2. (f(x+h)-f(x-h))/(2h)
We test it for f(x)=log(1+x) at x=0. Modify the coefficient c used for Richardson extrapolation
and observe and explain what value of c makes it work.