06 - Lecture 6 Today’s class: • Summary of...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Lecture 6 Today’s class: • Summary of floating-point 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 = (b-a)*(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 (b-a) 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 round-off error. Reading Assignment 5: Q1 <----Lines deleted---> % Actual time-stepping; 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.

Page1 / 20

06 - Lecture 6 Today’s class: • Summary of...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online