Numerical methods and F90, fall 2015

Exercise 1

To have your solution accepted you must compile and execute the required program and include the source code and the output showing that the program works correctly.

Return your solutions to hannu.karttunen@utu.fi by noon of Wed, Sept 16.

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

2. Write a program that calculates the real roots of a second degree equation ax2+bx+c=0. The user is asked to enter the coefficients. (Do not iterate but use the exact expressions for the solutions.)

3. Try to solve the equation sin(x)-x+2=0 using the direct 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 + ...

The user is asked to give the number of terms.
Test what will happen when the number of terms becomes very big.