This preview shows page 1. Sign up to view the full content.
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 realmath 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. FloatingPoint Approximations
Maple works with exact values, but it can return a ﬂoatingpoint approximation up to about 228 digits, depending upon your computer’s resources. Ten or twenty accurate digits in ﬂoatingpoint numbers is adequate for many purposes, but two problems severely limit the usefulness of such a system. • When subtracting two ﬂoatingpoint numbers of almost equal magnitude, the relative error of the diﬀerence may be very large. This is known as catastrophic cancellation. For example, if two numbers are identical in their ﬁrst seventeen (of twenty) digits, their diﬀerence is a threedigit 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 ﬂoatingpoint 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 ﬂoatingpoint approximations by including at least one ﬂoatingpoint number in each expression. Floats are contagious : if an expression contains one ﬂoatingpoint number, Maple evaluates the entire expression using ﬂoatingpoint 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.
 Spring '12
 NIL
 Math, Division

Click to edit the document details