Physics 223 and 229B, Winter 2002, Prof. White

Homework 1

Due Tuesday, Jan. 22

Turn in both your C programs and your sample output for each problem.

1. Write a program which inputs two integers, and prints out all prime numbers between them (including the input numbers themselves, if prime).

2. The divide and average method for the square root can be generalized to cube roots. The basic formula to solve c^3 = x is c' = a c + b x/(c*c), where a and b are specific constants. Derive values of a and b so that the convergence of this iteration is quadratic, epsilon -> epsilon^2 (turn in your derivation too). Write a function to implement the routine and a main program to test it.

3. Write a bisection method program and use it to solve x = cos(x/2).