Numerical methods and F90, spring 2010

Exercise 1

Return your answers no later than Jan 20.

1. Write a program that asks three numbers and prints their mean value.

2. Write the statements for computing rectangular coordinates from given spherical coordinates. Declare all variables present in the program.

3. Try to solve the equation exp(x)-x2=2 using the direrct iteration program. There are two different ways to write the equation in the required form. Try both forms to see if they will converge.

4. Write a program that calculates the sum of the harmonic series

1 + 1/2 + 1/3 +1/4 + ...

a) The user is asked to give the number of terms.
b) Modify the program so that the computation is finished also when the next term is smaller than 10-5.