{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Mth510Asgt1Solutions_W05

Mth510Asgt1Solutions_W05 - Mathematics 510 Winter 2005...

Info icon This preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Mathematics 510 Winter 2005 Problem Set 1 Solutions Problems 1. (a) Write and execute a program to determine your computer’s machine epsilon and display the result. Check this with the built-in routine if one exists with your software (eps in Matlab). Here is a program to do both and realmin in one go. #include<math.h> #include<iostream.h> int main() { double temp = 1.5, factor = 0.5; int N = 0; while( temp > 1 ) //Find Machine Epsilon { factor *= 0.5; temp = 1+factor; N++; } cout << N << endl; // Then eps = 2 - N . while(factor > 0) //Find smallest floating point number { factor *= 0.5; N++; } cout << N << endl; // Then min = 2 - N . return 0; } On my machine, eps= 2 - 52 and min = 2 - 1074 . If you used Maple to do this, you may have gotten completely differnt results. This is due to the symbolic nature of Maple. (b) Graph the two functions f 1 ( x ) = (1 + x ) - 1 and f 2 ( x ) = x vs. x on the same plot for x ranging from 0 to about 10 times the machine epsilon. If the two plots are not the same explain the difference. If you did this in Matlab you should have gotten two different pictures. The graph of x vs. x is simply a diagonal line. For
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}