LearningGuide

# The ditto operator is a shorthand reference to the

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

This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ); 158 This answer indicates the number of digits in the last example. The ditto operator, (%), is a shorthand reference to the result of the previous computation. To recall the second- or third-most previous computation result, use %% and %%%, respectively. 2.2 Numerical Computations Table 2.1 Commands for Working with Integers •9 Function abs factorial iquo irem iroot isqrt max, min mod surd Description absolute value of an expression factorial of an integer quotient of an integer division remainder of an integer division approximate integer root of an integer approximate integer square root of an integer maximum and minimum of a set of inputs modular arithmetic real root of an integer Commands for Working With Integers Maple has many commands for working with integers, some of which allow for calculations of the factorization of an integer, the greatest common divisor (gcd) of two integers, integer quotients and remainders, and primality tests. See the following examples, as well as Table 2.1. &gt; ifactor(60); (2)2 (3) (5) &gt; igcd(123, 45); 3 &gt; iquo(25,3); 8 &gt; isprime(18002676583); true 10 • Chapter 2: Mathematics with Maple: The Basics Exact Arithmetic—Rationals, Irrationals, and Constants Maple can perform exact rational arithmetic, that is, work with rational numbers (fractions) without reducing them to ﬂoating-point approximations. &gt; 1/2 + 1/3; 5 6 Maple handles the rational numbers and produces an exact result. The distinction between exact and approximate results is important. The ability to perform exact computations with computers enables you to solve a range of problems. Maple can produce ﬂoating-point estimates. Maple can work with ﬂoating-point numbers with many thousands of digits, producing accurate estimates of exact expressions. &gt; Pi; π &gt; evalf(Pi, 100); 3.1415926535897932384626433832795028841\ 97169399375105820974944592307816406286\ 208998628034825342117068 Maple distinguishes between exact and ﬂoating-point representations of values. Here is an example of a rational (exact) number. &gt; 1/3; 1 3 The following is its ﬂoating-point approximation (shown to ten digits, by default). &gt; evalf(%); 0.3333333333 These results are not the same mathematically, and they are not the same in Maple. 2.2 Numerical Computations • 11 Important: Whenever you enter a number in decimal form, Maple treats it as a ﬂoating-point approximation. The presence of a decimal number in an expression causes Maple to produce an approximate ﬂoating-point result, since it cannot produce an exact solution from approximate data. Use ﬂoating-point numbers when you want to restrict Maple to working with non-exact expressions. &gt; 3/2*5; 15 2 &gt; 1.5*5; 7.5 You can enter exact quantities by using symbolic representation, for example, π in contrast to 3.14. Maple interprets irrational numbers as exact quantities. Here is how you represent the square root of two in Maple. &gt; sqrt(2); √ 2 Here is another square root example...
View Full Document

Ask a homework question - tutors are online