It works with them as exact quantities pi sinpi 0 12

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

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

Unformatted text preview: . > sqrt(3)^2; 3 Maple recognizes the standard mathematical constants, such as π and the base of the natural logarithms, e. It works with them as exact quantities. > Pi; π > sin(Pi); 0 12 • Chapter 2: Mathematics with Maple: The Basics The exponential function is represented by the Maple function exp. > exp(1); e > ln(exp(5)); 5 The example with π may look confusing. When Maple is producing typeset real-math notation, it attempts to represent mathematical expressions as you might write them yourself. Thus, you enter π as Pi and Maple displays it as π . Maple is case sensitive. Ensure that you use proper capitalization when stating these constants. The names Pi, pi, and PI are distinct. The names pi and PI are used to display the lowercase and uppercase Greek letters π and Π, respectively. For more information on Maple constants, enter ?constants at the Maple prompt. Floating-Point Approximations Maple works with exact values, but it can return a floating-point approximation up to about 228 digits, depending upon your computer’s resources. Ten or twenty accurate digits in floating-point numbers is adequate for many purposes, but two problems severely limit the usefulness of such a system. • When subtracting two floating-point numbers of almost equal magnitude, the relative error of the difference may be very large. This is known as catastrophic cancellation. For example, if two numbers are identical in their first seventeen (of twenty) digits, their difference is a three-digit number accurate to only three digits. In this case, you would need to use almost forty digits to produce twenty accurate digits in the answer. • The mathematical form of the result is more concise, compact, and convenient than its numerical value. For instance, an exponential function provides more information about the nature of a phenomenon than a large set of numbers with twenty accurate digits. An exact analytical description can also determine the behavior of a function when extrapolating to regions for which no data exists. 2.2 Numerical Computations • 13 The evalf command converts an exact numerical expression to a floating-point number. > evalf(Pi); 3.141592654 By default, Maple calculates the result using ten digits of accuracy, but you can specify any number of digits. Indicate the number after the numerical expression, using the following notation. > evalf(Pi, 200); 3.1415926535897932384626433832795028841\ 97169399375105820974944592307816406286\ 20899862803482534211706798214808651328\ 23066470938446095505822317253594081284\ 81117450284102701938521105559644622948\ 9549303820 You can also force Maple to do all its computations with floating-point approximations by including at least one floating-point number in each expression. Floats are contagious : if an expression contains one floatingpoint number, Maple evaluates the entire expression using floating-point arithmetic. > 1/3 + 1/4 + 1/5.3; 0.7720125786 > sin(0.2); 0.1986693308 The optional second...
View Full Document

This note was uploaded on 08/27/2012 for the course MATH 1100 taught by Professor Nil during the Spring '12 term at National University of Singapore.

Ask a homework question - tutors are online