This preview shows page 1. Sign up to view the full content.
Unformatted text preview: argument to evalf controls the number of ﬂoating-point digits for that particular calculation, and the special variable Digits sets the number of ﬂoating-point digits for all subsequent calculations.
> Digits := 20; Digits := 20 14 • Chapter 2: Mathematics with Maple: The Basics > sin(0.2); 0.19866933079506121546 Digits is now set to twenty, which Maple then uses at each step in a calculation. Maple works like a calculator or an ordinary computer application in this respect. When you evaluate a complicated numerical expression, errors can accumulate to reduce the accuracy of the result to less than twenty digits. In general, setting Digits to produce a given accuracy is not easy, as the ﬁnal result depends on your particular question. Using larger values, however, usually gives you some indication. If required, Maple can provide extreme ﬂoating-point accuracy. Arithmetic with Special Numbers
Maple can work with complex numbers. I is the Maple default symbol for √ the square root of minus one, that is, I = −1.
> (2 + 5*I) + (1 - I); 3 + 4I
> (1 + I)/(3 - 2*I); 5 1 + I 13 13 You can also work with other bases and number systems.
> convert(247, binary); 11110111
> convert(1023, hex); 3FF
> convert(17, base, 3); [2, 2, 1] 2.2 Numerical Computations • 15 Maple returns an integer base conversion as a list of digits; otherwise, a line of numbers, like 221, may be ambiguous, especially when dealing with large bases. Note that Maple lists the digits in order from least signiﬁcant to most signiﬁcant. Maple also supports arithmetic in ﬁnite rings and ﬁelds.
> 27 mod 4; 3 Symmetric and positive representations are both available.
> mods(27,4); −1
> modp(27,4); 3 The default for the mod command is positive representation, but you can change this option. For details, refer to ?mod. Maple can work with Gaussian Integers . The GaussInt package has about thirty commands for working with these special numbers. For information about these commands, refer to ?GaussInt help page. Mathematical Functions
Maple contains all the standard mathematical functions (see Table 2.2 for a partial list).
> sin(Pi/4); 1√ 2 2
> ln(1); 0 16 • Chapter 2: Mathematics with Maple: The Basics Table 2.2 Select Mathematical Functions in Maple Function sin, cos, tan, etc. sinh, cosh, tanh, etc. arcsin, arccos, arctan, etc. exp ln log sqrt round trunc frac BesselI, BesselJ, BesselK, BesselY binomial erf, erfc Heaviside Dirac MeijerG Zeta LegendreKc, LegendreKc1, LegendreEc, LegendreEc1, LegendrePic, LegendrePic1 hypergeom Description trigonometric functions hyperbolic trigonometric functions inverse trigonometric functions exponential function natural logarithmic function logarithmic function base 10 algebraic square root function round to the nearest integer truncate to the integer part fractional part Bessel functions binomial function error & complementary error functions Heaviside step function Dirac delta function Meijer G function Riemann Zeta function Legendre’s elliptic integrals hypergeometri...
View Full Document