ps0 - Issued February 3rd 2005 13.002 Introduction to...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Issued: February 3rd, 2005 13.002 Introduction to Numerical Methods for Engineers In-class programming exercises 1. Let a be a positive real number, and let the sequence of real numbers x i be given by 1 a x 0 = 1 , x i +1 = 2 ( x i + x i ) , for i = 0 , 1 , 2 , 3 , . . . . The value x i will converge to ± a as i −² Write a program that reads in the value of a interactively and uses this algorithm to compute the square root of a . Test your program as you vary the maximum number of iterations of the algorithm is increased from 1 , 2 , 3 , . . . and determine how many significant digits of precision that you obtain for each. How many iterations are necessary to reach the machine precision of matlab? 2. Write a program to evaluate e by the series: 1 1 1 1 e = 1 + 1 + + + + + . . . 2! 3! 4! 5! Test your program as you increase the number of terms in the series. Determine how many significant digits of precision
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Ask a homework question - tutors are online