CSCE 340/840 Computer Assignment 1

Due: January 29, 2002

(100 points)

Solution of Equations in One Variable

Write or use subroutines to solve f(x) = 0 by the bisection method, fixed-point iteration, and the Newton-Raphson method. Calculate UROUND, the unit round-off error, for the computer that you are using and print UROUND.

Put convergence tests in your program so that answers are calculated to a relative error of 16*UROUND. However, stop the iteration if over 100 iterations are required; if this happens, indicate by an error flag or an appropriate message.

Print each iteration in tabular form as follows:

n xn f(xn) rn

where rn is an estimate of the relative error.

  1. Solve Problem 7b, Exercise Set 2.1, by all three methods.
  2. Solve Problem 23, Exercise Set 2.2 OR Problem 23, Exercise Set 2.3, by all three methods.

Answer the following:

  1. Was the correct order of convergence observed? Explain.
  2. Did any x0 cause divergence?
  3. Explain anything unusual or any difficulties.

You will be graded on your convergences test, ease of changing to a different f(x), modularity, comments, answers to questions, and your description of these items.

You must have your name, course name and number, assignment number, and date on the first page of the material that you hand in. See the separate document on homework and computer standards and grading along with what and how you turn in your assignments.