Numerical methods and F90, fall 2015

Exercise 3

Return your answers by noon of Wed, Sep 30.

To make checking easier, please put all source codes and output in a single file (.txt or .pdf). The stupid Outlook mail program cannot open files with some other extensions but requires that they are first saved to disk, which takes more time.

Also, include your student number (opinotkirjan numero). Then I can publish the credits without revealing the names.

1. Implement a function that will solve the equation x=f(x) using direct iteration. The function f is given as a parameter to the solver.
Test the program by solving the equation x3 - x + 1 = 0.

2. In the Demo programs you can find a linear algebra module. Use the routines to solve the set of equations:

  | 1  2  3  4  |      | 20 |
  | 1  3  1  2  | x =  | 11 |
  | 2  1  1  1  |      |  6 |
  | 3  1  0  1  |      |  4 |

3. Try to solve the equation of the previous problem using Jacobian iteration. What happens? Then try to make the matrix diagonal dominant by adding 10 to each of the diagonal elements; thus the new set of equations is

  |11  2  3  4  |      | 20 |
  | 1 13  1  2  | x =  | 11 |
  | 2  1 11  1  |      |  6 |
  | 3  1  0 11  |      |  4 |

4. Write a main program for testing the rational number module.