<<

"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 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 . number of special points, but over half the 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: 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 , non-integer powers such as existence of branch cuts, we get the problem of a lack of , 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 , 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. With economy (it is wasteful to compute a real arcsin in terms of complex sufficient care, this technique can be used for other branch cuts. logarithms and square roots) why a numerical, or even symbolic, im- 5Note that the sign convention here is the opposite to that of [4], plementation should be different, but the semantics should be those of this definition in terms of logarithms, possibly augmented by ex- defined /C(z) L ~-~z£= J: the authors of [4] recanted later to which as ceptional values when the logarithm formula is ill-defined. keep the number of --ls occurring in formulae to a minimum.

59 axis, passing through infinity if necessary: arctan is a 4 Inverse Trigonometric Functions good example. In this section, we describe the OpenMath definitions for Again, this doesn't disambiguate completely, and may these functions in terms of logaxithms (principle 2), and only be a weak guide if the behaviour over R is poorly highlight some of the identities and non-identities that re- specified. sult. 4. As many as possible of the 'well-known' identities should hold, at least off the branch cuts. 4.1 Definition of axcsin z Even more than item (3) above, this is subjective, but [2, page 79] gives the branch cuts 7 (-oo, -1) and (1, c~), but still worth adhering to. The decision as to which iden- does not specify the values on the branch cut. Two obvious tity is 'more fundamental' than another often depends identities that we want axcsin to satisfy axe on the application being considered, and can therefore seem very controversial. axcsin(--z) = -- arcsin(z) (14) 5. Occam 's razor. and The plethora of trigonometric and hyperbolic functions ~(z) = ~_~(~). (15) is due partly to the requirements of mathematical ta- wishful wishful bles and their users. For example, cot is frequently In fact the second cannot be satisfied on these branch cuts: tabulated because, near 7r/2, it is much easier to use arcsin(2) = ~ - 1.3169...i, so ~(2) would have to than a table of tan, in which interpolation is difficult, wishful even though it is logically redundant in tables (and be ~ + 1.3169...i, but 2 = 2. As in the case of the calculators) that contain reciprocals and tangents. In logarithm, these problems can be resolved by signed ze- general, we should not define functions in OpenMath ros [10] or by unwinding numbers [4]. For signed zeros, by formulae which axe subtly different from other for- mulae. The programming language Pascal [8] takes this 2 = 2 + 0+i, and 2 + 0+i = 2 + 0-i, and we are at liberty to define axcsin(2 + 0+i) = ~ - 1.3169i but axcsin(2 + 0-i) = principle to extremes: the only trigonometric functions iv defined are sin, cos and axctan. No hyperbolic functions + 1.3169i. However, as pointed out above, we axe now are defined. However, OpenMath is meant to be usable equivocal on the value of axcsin 2. for encoding the full range of mathematical texts, and We require that, as functions R --~ R, on [-1,1] these do use functions other thart sin, cos and axctan. sin(axcsin(x)) is the identity, and axcsin(sin(~)) is the iden- However, the definitions of versine and haversine should tity on [-~-/2, ~-/2] (and cannot be on a greater range, since probably be relegated to the historical CD. sin ceases to be injective). We adopt the suggestion in [10], that arcsin be defined There is one exception to this that we will see later: by the expression we define axccot (and axccoth) ab initio rather than in terms of axctan (or arctanh) in order to prevent re- maxkable behaviour near zero (which would otherwise be inherited from unremaxkable behaviour near infin- ity). This has the correct behaviour on R, and satisfies(14), even on the branch cut; but not (15). The unwinding number 6. Couthness solution to (15) is given by the following result. Since there axe well known relations between the hy- Lemma 1 axcsin z can be 'simplified': perbolic and trigonometric functions, there should be similar ones between their inverse functions. If h is any arcsinz = (-1) Ic(-In(1-z2)) arcsin~ hyperbolic function, and t the corresponding trigono- + ~pc(- in(1 + z)) - ~c(- ln(1 - z)) (17) metric function, we have a relation The proof is in Appendix A. I 1 cos,sec t(z) = ch(iz) where c = i cot, cosec. (12) 4.2 Definition of arccos z -i sin, tan This has the same branch cuts as axcsin in [2], and there- From this it follows ]ormally that fore the same problems. As functions R ~ R, on [-I, I] cos(axccos(x))is the identity,and arccos(cos(x))is the iden- tity on [0,Ir] (and cannot be on a greater range, since cos ceases to be injective). We adopt the suggestion in [10],defining Definition 1 A choice of branch cuts for h -1 and t -1 is said to be a couth pair of choices if equation. (13) holds except possibly at finitely many points. axccos(z) = ~7r_ axcsin(z)= y2 In (V ~--+ ,~/~). 1 - z •

Of course, there could exist multiple pairs of definitions (is) for h -1 and t -x, each pair being couth in itself. This satisfiesaxccos(-z) = ~" - axccos(z) everywhere, as we might expect from R. rln fact, [2] does not specify the closure of the branch cuts except in the case of In: we have completed the definitions.

60 Lemma 2 An alternative formulation is definition of arccot(-1), though any other negative number would do. This gives the following results. arccos(z) = -iln (z + i l~-- zz) . (19) [2] 1st printing 37r/4 inconsistent [2] 9th printing -~r/4 This is trivially equal to: [7] 5th edition ? inconsistent [16] 30th edition 37r/4 inconsistent Maple V release 5 31r/4 --iln (z -I-iV/(1- zi(1 + z)) Axiom 2.1 3~r/4 Mathematica [14] -Ir/4 which may be numerically more stable near z = ::1=1. This Reduce 3.4.1 -7r/4 in floating point issue, and the choice between (18) and (19), which may de- Matlab 5.3.0 -7r/4 in floating point pend on the availability of hardware square-root capability, Matlab 5.3.0 37r/4 symbolic toolbox are beyond the scope of this paper. The proof is in Appendix In the absence of any consensus, we appeal to Occam's razor, B. and, since cot(z) = 1/tan(z), we wish to define arccot(z) by (23). In fact, we need to be slightly more careful, since this 4.3 Definition of arctan z does not define arccot(0). To solve this problem and have arccot(0) = 7r/2 (i.e. interpreting 1/0 as +c¢~ rather than [2] gives the following branch cuts: (-ice,-i] and [i, ic~). -oo), we follow [10] and define [10] suggests, and we will adopt, the following definition: 1 (=÷q arccotz=~ln -- . (25) ~/(in(1 + iz) - In(1 -- iz)). (20) ~z -- i/ The apparently similar equation 9 This satisfies arctan(-z) = - arctan(z), (21) arccot z = ~ In [a] and is now the definition adopted by Common Lisp [13, p. 309], replacing in fact defines -arccot(-z), which takes the value -7r/2 rather than ~r/2 at z = 0, but is equal everywhere else real. -iln ((1 + i=)Jl/(1 + z2)), In fact, the two differ only on the branch cuts.

which does not satisfy (21). 4.5 Definition of arcsec z With this definition, we have the following relationship [2] gives the branch cut (-1, 1). The parsimony principle (proved in Appendix D) between arcsin and arctan: mentioned above would define this in terms of arccos, viz. Z arcsin z = arctan ~+r/C(- ln(l+z))-Tr/C(- ln(1-z)) arcsec(:)----arccos(i/z)-----iln (l/z +i~). (22) (26) This satisfies the rule that arcsec(-z) = ~r - arcsec(z). The 4.4 Definition of arccot z singularity at z = 0 is genuine. [2] (page 79) gives the branch cut [-i, i] from the ninth print- ing on, with the definition 4.6 Definition of arccsc z The branch cuts are as for arcsec. Again, we should define arccot z = arctan(1/z). (23) this in terms of arcsin, viz. However, according to [10]s, earlier printings gave the defi- nition 7r arccot z = ~ - arctan z. (24) This satisfies the rule that arccsc(-z) = - arccsc(z). Again, It should be noted that definition (23), regarded as the defi- the singularity at z = 0 is genuine. nition of a purely real function, has a range of (-r/2, r/2) \ {0}, with a singularity at z = 0 (probably intended to be 5 Inverse Hyperbolic Functions given the value 1r/2, but this has to be inferred from [2l), whereas (24) has a range of (0, 7r) and no singularity. The This section lays out our proposals for the definition of the branch cuts for (24) are clearly those for arctan. corresponding inverse hyperbolic functions. Questions of There is no clear standard for the definition of arccot as couthness, i.e. how this material relates to that of the pre- a function l:t ---+R: the standard shibboleth is to ask for the vious section, are deferred until the next section. SAtypically, Kahan is guilty of over-simplification here. The defi- 9This, in its equivalent form -~ In iz-liz't'l, is quoted in [3, p. 579] nition (equation 4.4.8) was always (23), with the branch cuts as listed. However the claimed range was 0 < arccot z _< rr (note the < rather as the definition of arccot. The authors are grateful to Prof. Pohst than <), with the formula arccot(--z) -~ lr -- arccot(z), which-is alge- for this information. braically inconsistent with (23) and with (21), which was quoted in all printings. This inconsistency has been reproduced in as recent a source as [16] on pages 465-466.

61 5.1 Definition of arcsinh z 5.6 Definition of arccsch z [2] gives the branch cuts: (-ioo, -i) and (i, ioo). We follow [2] gives the branch cut (-1, 1). Definition in terms of the [10], which gives the principal expression formula for arcsinh would give

arcsinh(z) ----in (z -t- V/1-~), (28) and this satisfies the symmetry rule: arcsinh(z) --- - arcsinh(-z) This also has a singularity at z = 0. 5.2 Definition of arccoshz 6 How Couth are We? [2] gives the branch cut (-oo, 1): in addition there is a branch point at z = -1. We follow [10], which giw~s the In this section, we examine how the various choices we have primary expression outlined in the previous two sections fit in with the definition of couthness given above.

6.1 Couthness of arcsin / arcsinh In this case, equation(13) translates into 5.3 Definition of arctanh z [2] gives the branch cuts: (-oo,-1] and [1, oo). We follow arcsinh(iz) ~ i arcsin(z). (36) [10], which gives the principal expression Substituting in equations (16) and (28) gives arctanh(z) = 1 (In(1 ÷ z) -- In(1 -- z)). (30) This satisfies arctanh(z) ---- -arctanh(-z). which is patently true. So these two definitions are couth. 5.4 Definition of arccoth z [2] gives the branch cut [-1, 1]. We define arccoth by 6.2 Couthness of arccos / arccosh In this case, equation(13) translates into arccoth z = ~1 In ~z-~/" { z ÷ 1 ~ (31) The expressionderived from that of arctanh would be arccosh(z) ~ i arccos(z). (37) arccoth (z)=1 ~ ( In(l+~)-- 1 ln(1 _1~) ) . (32) Substituting in equations (18) and (29) gives

tanh--based However, this has a jump discontinuity in the imaginary part along the real axis, corresponding to an inconsistency in the imaginary part of arctanh near Zoo, with ~ arccoth z ---- The difference between the two is that the left-hand side tanh-- based has V/~, whereas the right-hand side has iv/~. Now, a lr/2 for real z < 0, and -~r/2 for z ~ 0. An apparently consequence of the branch cut (1) for In is that every square similar formulation would be root has its argument in the range -~ ~ arg ~_~, = so these arccoth(z) = ~1 (In(-1 - z) - In(1 - z)) (33) two cannot be equal everywhere. In fact, they are equal when arg (V/~) ~ 0, which simplifies to arg(1- z) ~ 0, Superficially, this has a branch cut on (-oo, 1], but in fact the branch cuts of the two logarithms cancel on (-c~, -1), i.e. when ~z > 0 or ~z -- 0 and ~(1 - z) ~_ 0, i.e. Rz ~_ 1. so that the branch cut is in fact [-1, 1]. This satisfies This region is the upper half-plane, including the real axis arccoth(-z) = - arceoth(z) except at z ----0. for ~z < 1. Lemma 3 Equations (31) and (33) define the same func- tion. 6.3 Couthness of arctan / arctanh The proof is in Appendix C. In this case, equation(13) translates into

5.5 Definition of arcsech z arctanh(iz) -~ i arctan(z). (38) [2] gives the branch cuts: (-oo, 0] and (1, oo). Definition in Substituting in equations (20) and (30) gives terms of the formula for arccosh would give I (in(1 + iz)- ln(1- iz))~i (2~ (In(1 + iz)- ln(1- iz))) arcsech(z) 2 In ~V ~ + V -2z-) • (34) These are clearly equal everywhere. The singularity at z -- 0 is genuine.

62 6.4 Couthness of arccot / arccoth 7 Implications for Phrase-book Writers

In this case, equation(13) translates into An OpenMath phrase-book is actually a piece of software that translates between the semantics of OpenMath (as de- arccoth(-iz) ~ i arccot(z). (39) fined in the Content Dictionaries) and the semantics of a Substituting in equations (25) and (31) gives particular application, as well as simply translating names. Of course, life for the phrase-book writer is simplest if the 5In =i In semantics of the application are the same as those of Open- xz -- i// Math, but this will not always be the case. A classic example of this would be the translation of Since the inputs x° to the logarithms are equal, this is trivial. arccot between OpenMath, whose semantics we propose to define by (25), and a system, such as Maple or Axiom, where 6.5 Couthness of arcsec / arcsech the semantics of arccot are defined by (24). In this case, equation(13) translates into Application--~OpenMath arccot z ~ ~ - arctan z OpenMath-+Application arccot z ~ arctan (l/z) arcsech(z) ~ i arcsec(z). (40) Derive has a different definition of arctan to eliminate the unwinding numbers from (22), so that, for Derive, Substituting in equations (26) and (34) gives arcsin(z) = arctan ~ This definition can be related Derive to that of OpenMath either via unwinding numbers or via 21n \V( z~ -~-- + ~z z) a in (1/z +iv~-~-lT~ ) ,~..~(z) = arctan~. It is often possible to deal with such (41) Derive At z = ½, this becomes differences on branch cuts by such a 'double conjugate' rep- resentation. This representation has the advantage that the (always legal) rule ~ ~ z means that the transformation is self-inverse. a palpable falsehood. In fact, one side is the negation of the 8 Proposals other. Now, lemma 2 shows that This section lists the concrete suggestions that the authors have for OpenMath. 1. OpenMath should define a b (in the case of non-integer b) via Replacing z by 1/z gives a b = exp(b in a), (43) rather than the current weasel words: "When the sec- In ¼+i =21nv V--W/" ond argument is not an integer care should be taken as to the meaning of this function; however it is here to represent general powering" (axithl. ocd [11]). Substituting this into equation (41) gives 2. OpenMath should base all its single-valued definitions of the naturally multi-valued elementary functions on the logarithm function. This means that it would be reasonable to define all the forward functions in terms Since lna = lnb if and only if a = b, this reduces to of the exponential function. ~ iv/ST. These are equal when arg ~ < 0, 3. OpenMath should be parsimonious in terms of the equivalent to arg(1 - 1/z) < 0 This is true precisely number of (subtly) different concepts it introduces: in when ~z < 0 or ~z = 0 and ~z _> 1. Hence the pair particular cot, sec and cosec, and their inverses and hy- arcsec/arcsech is not couth. perbolic analogues should be defined 11 in terms of the other functions and reciprocals. 6.6 Couthness of arccsc / arccsch The actual proposals for the definitions of functions are In this case, equation(13) translates into summarised below. llOne could argue that these functions need not be defined at all. arccsch(-iz) ~ i arccsc(z). (42) Indeed tan could be replaced by sin/cos etc. This would create problems for renderers, but these are not insuperable, and getting Substituting in equations (27) and (35) gives g0od-looking out of OpenMath already requires a cer- tain amount of intelligence on the part of the renderers. However, not having these functions would, we argue, actually increase the In _---~z+ 1+ ~ = In + risk of the sort of subtle mis-understanding that this paper is meant to point out (e.g. defining arccot in terms of arctan leaves arccot(0) undefined, and the definition is non-triviah see the discussion after equation (25)), and makes it harder to write numerically-accurate These are patently equal. expressions. 1°It is tempting to a computer scientist to write "arguments of", but that way lles linguistic confusion.

63 arcsin (16) arcsinh (28) couth [14] Wolfram,S, The Mathematica Book. Wolfram Me- arccos (18) arccosh (29) uncouth dia/C.U.P., 1999. arctan (20) arctanh (30) couth arccot (25) arccoth (31) couth [15] World-Wide Web Consortium, Mathematical Markup arcsec (26) arcsech (34) uncouth Language (MathML) 2.0 Draft Specification. W3C arccsc (27) arccsch (35) couth Draft, revision of 28 March 2000. http://~.w3.org/ TR/2000/ND- Mat hFJ.,2- 20000328. 4. OpenMath should use the 'unwinding number' tbrmal- ism for stating any mathematical properties of these [16] Zwillinger,D. (ed.), CRC Standard Mathematical Tables functions (and therefore an OpenMath CD should de- and Formulae. 30th. ed., CRC Press, Boca Raton, 1996. fine the unwinding number). 5. OpenMath should not forbid the use of signed zeros, A Proof of Lemma 1 and therefore range restrictions such as (1) have to be The result to be proved is relaxed to non-strict inequalities in this case. Lemma 1 arcsinz can be 'simplified': 6. OpenMath should consider whether it wants (using dif- ferent symbols, e.g. Log) to represent the multi-valued arcsinz = (-1) Ic(-ln(1-z2)) arcsin~ inverse functions as well as the single-valued ones. + ~rJC(- ln(1 + z)) - 7tiC(- In(1 - z)) (17)

References Notice that the expression/C(- In(I-z2)) is the most concise characteristic function for the branch cuts of arcsin available [1] Abbott,J.A., D~az,A. & Sutor,R.S, OpenMath: A Pro- in this notation; the other unwinding numbers specify the tocol for the Exchange of Mathematical Information. positive and negative halves of the cut. SIGSAM Bulletin 30 (1996) 1 pp. 21-24. Proof: From the definition (16) [2] Abramowitz,M. & Stegun,I., Handbook of Mafl~emati- arcsin z = i ln(iz + ~/1 -- z 2) . cal Functions with Formulas, Graphs, and MatJiemati- cal Tables. US Government Printing Office, 1964. 10th Since In z = ln~ + 21ri/C (- In z), this becomes Printing December 1972. Note that [11] does nog define which printing to use. [3] Bronstein, Semendjajew & Musiol, Taschenbuch der Mathematik. Mfihlig in Harri Deutsch Verlag, Frank- The unwinding number is zero because it could only be furt 1995. nonzero when the input to log is real and negative, i.e. iz + ~/1 - z 2 = -e t with t E R. Re-arranging and squaring, [4] Corless,R.M. &Jeffrey, D.J., The Unwinding Number. 1--e 2t SIGSAM Bulletin 30 (1996) 2, pp. 28-35. -z 2 + 2ize ~ + e 2~ = 1- z 2, so z = "-5i5~-" So zis purely imaginary, but then the log input is always positive. Thus [5] Dalmas,S., Gai~tano,M. & Watt,S, An OpenMath 1.0 Implementation. Proc. ISSAC '97 (ed. W. Kfichlin), arcsinz = iln(--i~+--~) • ACM New York, 1997, pp. 241-248. [6] Encyclopedia Britannica, 15th. edition. Encyclopedia Now zl/2 = ~1/2 (_l)JC(- 1..), and therefore Britannica Inc., Chicago etc., 15th ed., 1995 printing. [7] Gradshteyn,I.S. & Ryzhik,I.M. (ed A. Jeffrey), Table arcsinz=iln(--i~+ %/1--~2(--1)K:(-1"0-~'))) • (44) of Integrals, Series and Products. 5th ed., Academic Press, 1994. Although (44) is a complete answer to the simplification, it does not explicitly contain arcsin, which is required. Using [8] IEEE Standard Pascal Computer Programming Lan- In z = - In z -1 - 27ri/C(- In z), we continue. guage. IEEE Inc., 1983. [9] IEEE Standard 754 for Binary Floating-Point Arith- arcsinz = -iln[(-i~+v/~-z2(-1)~c(-ln('-z2))) -1] metic. IEEE Inc., 1985. [10] Kahan,W., Branch Cuts for Complex Elementary Func- (-In(-i: + 4:-:-;:)) tions. The State of Art in Numerical Analysis (ed. A, Iserles & M.J.D. Powell), Clarendon Press, Oxford, As above, the last term is zero, and rationalising the first 1987, pp. 165-211. term gives [11] The OpenMath Consortium. Draft Content Dictionar- -iln (iN + V/1 - ~2 (_1)~3(-In(I-z2)))(45) ies. arcsin z http ://www. nag. co. uk/pro ject s/0penMath/corecd If z is not on the branch cut, then/C is zero and we have [12] Rich,A.D. and Jeffrey,D.J., Function evaluation on immediately arcsin z = arcsin ~. If z is on the branch cut, branch cuts. SIGSAM Bulletin 116(1996). and again we wish to see arcsin, then returning to (44) gives [13] Steele,G.L.,Jr., Common LISP: The Language, 2nd. edition. Digital Press, 1990. arcsin z =iln (--i~ -- V/~)

64 Invoking ln(-zl) = In zl + iTr -- 27rilE(lit + In Zl) gives sepa- D arcsin and arctan rately {--arcsinS+~r z > 1 The aim of this section is to prove that arcsinz = --arcsin~--zr z < --I Z Since /C(-In(1 - z)) = -1 for z > 1, and similarly for arcsin z = arctan ---~-~+Tr/C(- In(l+z))-Tr/C(- In(l-z)) z < -1, the lemma follows. (22) We start from equations (16) and (20). Then B Proof ofLemma 2 Z 2i arctan Lemma 2 An alternative formulation is x/1 - z 2

arccos(z) = --iln (z + i lxf------z2) . (19)

Proof. Now

V T +'v = z+i¢l- +z= +2~-i~c ln(1 +,--~) - ln(1 -~ ,---~1

since the imaginary parts of I - z and 1 + z have opposite = ln[iz+ ~1 - z2] 2 signs. Also 21na = ln(a 2) if/C(21na) = 0, so we need only show this last stipulation i.e. that +2~-aC(ln(1 + i-~) Z - In(1 - i--p_--T)) Z

~r (~2+z . 1-z ~r = 2i arcsin(z) -~ < arg x----+~) _

iV/~ = it for t E It. Squaring both sides, z + i~/T'= z 2 = The tendency for /C factors to proliferate is clear. To -t 2, i.e. (z+t2) 2 = -(1-z2). Hence 2zt 2+t 4 = -1, simplify we proceed as follows. Consider first the term so z = -(1 + t4)/2t 2 _< -1, and in particular is real. On this half-line, the argument in question is +7r/2, which is ~(21n(iz + Vii- ~2)). acceptable. Hence the argument never leaves the desired range, and the lemma is proved. For ]z] < 1, the real part of the logarithm's input is positive and hence/C = 0. For Izl > 1, we solve for the critical case C Proof ofLemma 3 in which the input to K is -It and find only z = rexp(i~-), with r > 1. Therefore Lemma 3 Equations (31) and (33) define the same func- tion. ~(2 In(iz + x/1 - z2)) = ~(_ In(1 + z)). Proof. This reduces to Repeating the procedure with (z+l In \z-~'T/ = In(--1 -- z) - ln(1 -- z). /C(In(1 + iz/v/i - z 2) - In(1 - iz/~/1 - z2))

The left-hand side is clearly equal to In (~-~-), which shows that/C ~ 0 only for z > 1. Therefore seems equal to the right-hand side, and in fact differs by 27rilC(ln(- 1 --z) -In(1 -z)), by the quotient variant of (7). ]C(In(l+iz/x/1 - z2)-In(1-iz/v/TZ z2)) = IC(-In(l-z)) We look at the curves where/C can change value, i.e. the boundaries of the 'clear-cut region'/C = 0: and so finally we get

In(--1 - z) - In(1 -- z) = t =t: iTr t ~ R Z arctan ~ = arcsin(z)-Tr/C(- In(l+z))+Tr/C(- In(l-z)) and the branch cuts of the individual logarithms, which are --1-- z = --e t and 1- z = -e t (using -e t for t E R as (46) and this cannot be simplified further. an encoding of the negative real axis). The last two are z = e t - 1 and z = e t + 1, while the first is ~-~ = e t, e t --I i.e. z = ~Tf" Hence all problematic values are for real z > -1. The complement of this is a connected region, so a trial at, say, z = -2 proves that /C = 0 everywhere except on this critical line. On the critical line z > -1, arg In(-1 -z) = It, and we subtract from this the argument of another real logarithm, which is either 0 or It. In either case ]C = O.

65