This preview shows pages 1–4. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Lecture 6 Today’s class: • Summary of floatingpoint arithmetic • Taylor’s theorem and truncation errors • Numerical differentiation • Modelling and computation This completes Part One of the course. Please consult the Objectives for Part One in the list of Course Objectives on WebCT. Reading Assignment 4: Q2 a = 1.23456789123456e10; b = 1.23456789123477e10; y1 = b^2  a^2; y2 = (ba)*(b+a); if (y1==y2) fprintf(’The results are identical.\n’); else fprintf(’The results differ!\n’); end Some of your responses: When executed, this code segment confirms y1 6 = y2 . Which is more accurate? The numbers a and b agree to 13 digits, so subtracting them yields a (catastrophic) cancellation error (loss of significant digits). However, by squaring a and b first and then subtracting, more significant digits are irretrievably lost. Hence, even though cancellation errors occur in computing (ba) and then multiplying it by (b+a), the net result is still more accurate than computing b^2 and a^2 and then subtracting. Therefore, we conclude that y2 is more accurate than y1 (neither is in fact "right"; in extended precision (using Maple), the true result would be 5.185185143185593e+7). My answer: y2 is the correct answer. y1 is the incorrect value because two very similar numbers are being subtracted and would probably lead to subtractive cancellation. I spent some time thinking about this question and I truly do not see why the computer would produce differring results. My only guess would be a roundoff error. Reading Assignment 5: Q1 <Lines deleted> % Actual timestepping; should break when t reaches t_final while (t ~= t_final) % Terminate at end of interval v = v + h*f(t,v); % Forward Euler step t = t + h; % Increment time tsol = [ tsol, t]; % Store updated time value vsol = [ vsol, v]; % Store updated solution value end <Lines deleted> The function brokenforwardeuler does not work as in tended. Identify the problem and fix it....
View
Full
Document
This note was uploaded on 06/20/2011 for the course MATH 2070 taught by Professor Aruliahdhavidhe during the Winter '10 term at UOIT.
 Winter '10
 aruliahdhavidhe

Click to edit the document details