"According to Abramowitz and Stegun" Or Arccoth Needn't Be Uncouth
Total Page:16
File Type:pdf, Size:1020Kb
"According to Abramowitz and Stegun" or arccoth needn't be uncouth Robert M. Corless James H. Davenport* David J. Jeffrey Dept. Mathematical Sciences Stephen M. Watt University of Bath Ontario Research Centre Bath BA2 7AY for Computer Algebra England . orcca.. On. Ca. jhd@maths, bath. ac, uk Abstract functions, as well as relations between these functions, and relations between them and the forward functions. This paper ~ addresses the definitions in OpenMath of the We discuss the implications of accurate translation on elementary functions. The original OpenMath definitions, the design of the phrasebooks [5] translating between Open- like most other sources, simply cite [2] as the definition. We Math and actual systems. Note that OpenMath does not show that this is not adequate, and propose precise defi- say that one definition is 'right' and another 'wrong': it nitions, and explore the relationships between these defini- merely provides a lingua francs for passing semantically ac- tions. curate representations between systems. Semantically cor- In particular, we introduce the concept of a couth pair rect phrasebooks would deduce that of definitions, e.g. of arcsin and arcsinh, and show t:hat the pair axccot and arccoth can be couth. z= Maple Derive 1 Introduction Notation. Throughout this paper, we use arccot etc to Definitions of the elementary functions are given in many mean the precise function definitions we are using, and vari- textbooks and mathematical tables, such as [2, 7, 16]. How- ants are indicated by annotations as in the equation above. ever, it is a sad fact that these definitions often require a Throughout, z and its decorations indicate complex vari- great deal of common sense to interpret them, or, to be ables, x and Y real variables. The symbol ~ denotes the blunt, are blatantly self-inconsistent: not just at ~ finite imaginary part, and ~ the real part, of a complex number. number of special points, but over half the complex plane The precise OpenMath proposals are listed at the end. or half the real line. This state of definition is insufficient for computer programming of any kind, and particularly so 2 The base case: Logarithms for a formal standard, such as OpenMath [1, 5], intended to allow expressions to be conveyed between systems, with all Let us begin with the simplest example, and the one in terms their semantics intact. of which we will define the other functions. The OpenMath definitions of complex elementary func- The definition of ln z (and hence that of z a = tions (contained in the Content Dictionaries2 tran~.cl and expalnz for a ~ Z). [2, p. 67] gives the branch cut (-c~,0], transc2 [li D generally state that the elementary functions and the rule [2, (4.1.2)] that are "as defined in Abramowitz and Stegun" [2], and there- fore implicitly single-valued functions. It is the contention -lr < ~ In z < It. (1) of this paper that this is insufficient, and more needs to be done to define the elementary functions precisely, par- This then completely specifies the behaviour of In: on the ticulaxly (but not exclusively) on their branch cuts. There branch cut it is closed on the positive imaginary side of the are even implications for the definition of functions on IR, cut, i.e. counter-clockwise continuous in the sense of [10]. notably arccot. This requirement for unambiguity affects What are the consequences of this definitionS? From the the definitions of the logarithm, non-integer powers such as existence of branch cuts, we get the problem of a lack of square root, and the inverse trigonometric and hyperbolic continuity: *This work was performed while the second author held the On- lira ln(z + iy) # In x : (2) tarlo Research Chair in Computer Algebra at the University of West- y--+0- ern Ontario. All authors are grateful for the comments of Dave Hare sWhich we do not contest: it seems that few people today would at Waterloo Maple Inc. and of many members of the OpenMath Es- support the rule one of us (JHD) was taught, viz. that 0 < ~ In z < prit project. 21r. The placement of the branch cut is 'merely' a notational conven- 1A previous version was a deliverable of the Esprit OpenMath tion, but an important one. If we wanted a function that behaves like Project, number 24969. In but with this cut, we could consider ln(--1) -- ln(--1/z) instead. 2In the process of being reshuffled to ensure alignment with We note that, until 1925, astronomers placed the branch cut between MathML version 2 [15], but this does not affect the thrust of this one day and the next at noon [6, vol. 15 p. 417]. paper. 58 for x < 0 the limit is In x - 2~ri. Related to this is the fact 3 General Principles that In ~ # In z (3) There is no 'right' answer to the specialisation of the one- many inverse trigonometric and hyperbolic functions. Here instead ln~ = ln z + 21ri on the cut. on the branch cut: we outline various principles that could be used to justify the Similarly, definitions of the functions (principles 1-2) and the choices In 1 ~ --In z (4) of one branch over another (principles 3-5). It should be Z noted that we cannot apply these principles to each function on the branch cut: instead In ½ = -ln z + 2z-i on the cut. in isolation, since the choices affect the validity of many Two families of solutions have been mooted to these identities between functions (principle 6). problems. • [10] points out that the concept of a "signed zero "4 1. For a trigonometric or hyperbolic function f, it should [9] (for clarity, we write the positive zero as 0 + and be the case that the negative one as 0-) can be used to solve prob- f(f-l(z))=z, (10) lems such as the above, if we say that, for x < 0, ln(x+0+i) = ln(x) +~ri whereas ln(x+0- 4) = ln(x)-~ri. at least off the branch cuts, and preferably on it. While Equation (2) then becomes an equality for all x, inter- this might seem obvious~ it does need to be checked. preting the x on the right as x+0-i. Similarly, (3) and Given arcsin, one might construct ~.. as follows. (4) become equalities throughout. Attractive though this proposal is (and OpenMath should probably not broken inhibit systems that do have signed zeros), it does not answer the fundamental question: what to do if the sint = ~l-cos 2t; user types ln(-1). t = arcsin ~/1--cos 2t A similar idea is proposed in [12], who make the func- tions two-valued on the branch cuts, so that In(-1) = ±~ri. This has the drawback of not fitting readily with so, writing t = ~.~u, numerical evaluation. broken More importantly, neither scheme addresses problems off the branch cuts. arccos u = arcsin ~ u 2. • [4] points out that most 'equalities' do not hold for the broken complex logarithm, e.g. ln(z 2) ~ 21nz (try z = -1), and its generalisation However cos arcsin ~/1 - u 2 is not the identity function, ln(zlz2) ~ lnzl + lnz2. (5) taking -1 to 1. In general, formal manipulation is not guaranteed to yield an actual inverse. The most fundamental of all non-equalities is z = In expz, with an obvious violation at z = 2~ri. They Since the functions f are many-one, asking for the con- therefore propose to introduce the unwinding number verse f-l(f(z)) = z is impossible. However, we could K, defined 5 by ask that the domain of validity of /C(z) = z- lnexpz [~z- ~r] f-l(f(z)) .= z (11) 21ri = |~[ e Z (6) be as 'natural' as possible. (note that the apparently equivalent definition |-Y-~---~-~/L 2~r J differs precisely on the branch cut for In as applied to 2. All these functions should be mathematically s defined exp z). (5) can then be rescued as in terms of In, thus inheriting their branch cuts from ln(zl z2) = In zl + In z2 - 27ri/C(ln zl + In z2). (7) the chosen branch cut for In (equation 1). This does not define the function uniquely: far from Similarly (3) can be rescued as that, but it does ensure that the functions can be un- In ~ = In z -- 21ri/C(ln z). (8) ambiguously reduced to logarithms, a bonus for sim- plification programs. This rule is essentially the same Note that, as part of the algebra of /C, /C(l~z) = as the "Principal Expression" rule of [10]; the differ- Ic(- lnz) ¢ ~C(ln~). ence is that [10] allows ( as a constructor. In prac- These problems translate into difficulties with the powering tice we use it as well, but consider it to be defined by operation, even in cases as apparently simple as square roots. v/z = exP(½ lnz). In fact, 3. The choice made for the branch cuts over C should be = V~'X/~ (--1) ~:(ln~l+ln,~). (9) consistent with the 'well-known' behaviour over R. This 4One could ask why zero should be special and have two values generally implies that branch cuts should avoid the real (or four in the Cartesian complex plane). The answer is that all the branch cuts we need to consider are on either the real or imaginary ~This does not imply that it is always right to compute them this axes, so the side to which the branch cut adheres depends on the way. There may be reasons of efficiency, numerical stability or plain sign of the imaginary or real part, including the sign of zero.