11.07.2015 Views

Advanced Programming Guide

Advanced Programming Guide

Advanced Programming Guide

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

206 • Chapter 5: Numerical <strong>Programming</strong> in MapleDigits are machine wordsize dependent. You can obtain the values forthese limits from the Maple_floats command.This software floating-point system is designed as a natural extensionof the industry standard for hardware floating-point computation, knownas IEEE 754. Thus, there are representations for infinity and undefined(what IEEE 754 calls a "NaN", meaning "Not a Number"). Complex numbersare represented by using the standard x + I*y format.One important feature of this system is that the floating-point representationof zero, 0., retains its arithmetic sign in computations. Thatis, Maple distinguishes between +0. and -0. when necessary. In mostsituations, this difference is irrelevant, but when dealing with functionssuch as ln(x), which have a discontinuity across the negative real axis,preserving the sign of the imaginary part of a number on the negativereal axis is important.For more intricate applications, Maple implements extensions of theIEEE 754 notion of a numeric event, and provides facilities for monitoringevents and their associated status flags. To learn more about thissystem, see the Maple Numerics Overview help page. Enter ?numericsat the Maple prompt.Roundoff ErrorWhen you perform floating-point arithmetic, whether using software orhardware floats, you are using approximate numbers rather than precisereal numbers or expressions. Maple can work with exact (symbolic)expressions. The difference between an exact real number and its floatingpointapproximation is called the roundoff error. For example, supposeyou request a floating-point representation of π.> pi := evalf(Pi);π := 3.141592654Maple rounds the precise value π to ten significant digits becauseDigits is set to its default value of 10. You can approximate the roundofferror above by temporarily increasing the value of Digits to 15.> evalf[15](Pi - pi);−0.41021 10 −9Roundoff errors arise from the representation of input data, and asa result of performing arithmetic operations. Each time you perform an

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!