Version 1.3 of ais/ai-00185.txt

Unformatted version of ais/ai-00185.txt version 1.3
Other versions for file ais/ai-00185.txt

!standard G.1.2 (15)          99-09-18 AI95-00185/01
!class binding interpretation 97-03-19
!status work item 99-09-18
!status received 97-03-19
!priority Medium
!difficulty Hard
!subject Branch cuts of inverse trigonometric and hyperbolic functions
!summary
Replace G.1.2(15-17) by:
The imaginary component of the result of the Arcsin, Arccos and Arctanh functions is discontinuous as the parameter X crosses the real axis to the left of -1.0 or the right of 1.0.
The real component of the result of the Arctan and Arcsinh functions is discontinuous as the parameter X crosses the imaginary axis below -i or above i.
The real component of the result of the Arccot function is discontinuous as the parameter X crosses the imaginary axis below -i or above i.
!question
The definition of the branch cuts in RM95 G.1.2(15-17) seem contradictory with other rules regarding these functions, and inconsistent with common mathematical practice.
!recommendation
(See summary.)
!wording
(See summary.)
!discussion
G.1.2(17) defines the branch cut of Arccot as follows:
"The real component of the result of the Arccot function is discontinuous as the parameter X crosses the imaginary axis between -i and i."
G.1.2(24) defines the principal value of Arccot as follows:
"The real component of the result of the Arccot function ranges from 0.0 to approximately Pi."
These two paragraphs contradict each other. Consider what happens when X is real and close to 0.0. Mathematically, the Arccot of 0.0 is any odd multiple of Pi/2.0. Because G.1.2(17) requires a discontinuity at 0.0, Arccot (-0.0) and Arccot (+0.0) must be two different odd multiples of Pi/2.0. But G.1.2(24) constrains the range of Arccot so that the only acceptable multiple of Pi/2.0 is Pi/2.0.
We resolve the contradiction by following G.1.2(24), because this paragraph is consistent with the definition of Arccot for a real argument, which states that the Arccot function "ranges from 0.0 to approximately Pi." (RM95 A.5.1(14-15))
Now consider the rules related to Arcsin:
"The real component of the result of the Arcsin function is discontinuous as the parameter X crosses the real axis to the left of -1.0 or the right of 1.0." (RM95 G.1.2(15))
and:
"The range of the real component of the result of the Arcsin function is approximately -Pi/2.0 to Pi/2.0." (RM95 G.1.2(23))
Remember that Arcsin is mathematically multivalued, so that, if Y is one possible result of Arcsin (X), then Pi - Y and Y + 2.0 * Pi are also possible results of Arcsin (X).
Consider what happens when X crosses the real axis to the right of 1.0. Let X = A + I * B a complex number where A > 0.0 and B is small compared to A (so that we can use first order approximation). A first order approximation of Arcsin (X) is:
Y = Pi / 2.0 + B / Sqrt (A**2 - 1.0) - I * Log (A + Sqrt (A**2 - 1.0))
When B > 0.0, the real part of Y is slightly above Pi / 2.0. In order to keep the real part of Arcsin (X) in the range -Pi / 2.0 .. Pi / 2.0, we have to use Y when B < 0.0 and Pi - Y when B > 0.0. This cause the imaginary part to become discontinuous. This illustrates that for this RM95 G.1.2(23) requires that the imaginary part, not the real part, be discontinuous when X crosses the real axis to the right of 1.0.
A similar analysis could be performed for X to the left of -1.0 and for Arccos and Arcsinh.
The rules given in the !summary correspond to the common mathematical definitions of these functions.
!appendix

!section G.1.2(15)
!subject Branch cuts of inverse trigonometric and hyperbolic functions
!reference RM95 G.1.2(15)
!reference RM95 G.1.2(16)
!reference RM95 G.1.2(17)
!reference RM95 G.1.2(24)
!from Pascal Leroy 97-03-10
!reference 97-15727.f Pascal Leroy 97-3-10>>
!discussion

G.1.2(17) defines the branch cut of Arccot as follows:

"The real component of the result of the Arccot function is discontinuous as
the parameter X crosses the imaginary axis between -i and i."

G.1.2(24) defines the principal value of Arccot as follows:

"The real component of the result of the Arccot function ranges from 0.0 to
approximately Pi."

These two paragraphs seem to contradict each other.  Consider what happens
when X is real and close to 0.0.  Mathematically, the Arccot of 0.0 is any odd
multiple of Pi/2.0.  Because G.1.2(17) requires a discontinuity at 0.0, Arccot
(-0.0) and Arccot (+0.0) must be two different odd multiples of Pi/2.0.  But
G.1.2(24) constrains the range of Arccot so that the only acceptable multiple
of Pi/2.0 is Pi/2.0.  So Arccot cannot be discontinuous at 0.0 after all...

Also, the paragraphs G.1.2(15) and G.1.2(16) define branch cuts as follows:

"The real (resp. imaginary) component of the result of the Arcsin and Arccos
(resp. Arctanh) functions is discontinuous as the parameter X crosses the real
axis to the left of -1.0 or the right of 1.0

The real (resp. imaginary) component of the result of the Arctan (resp
Arcsinh) functions is discontinuous as the parameter X crosses the imaginary
axis below -i or above i."

These rules are puzzling, because the natural mathematical definition of
Arcsin and Arccos is such that the real part is continuous; it is the
imaginary part which has branch cuts.  Similarly, the natural mathematical
definition of Arcsinh is such that the imaginary part is continuous; it is the
real part which has branch cuts.


****************************************************************

From: Mike Yoder
On: Monday, December 11, 2000, 5:33 PM

Re: AI95-00185, "Branch cuts of inverse trigonometric and hyperbolic functions"

I agree with the stated conclusions, and with the suggested fix.  I have a
mathematical quibble with one paragraph; this is given at the end, since it
affects no conclusions.  In the following, mathematical terminology is as in
Ahlfors, _Complex Analysis_, 2nd edition.

I had this significant difficulty: though I agree with the fixes, the RM
language as it stands doesn't imply that the fixes are the right ones.  Nor
does the Ada 95 Rationale provide any help.  There is, however, a simple
principle that would make all cases unambiguous for all practical purposes:
namely, that the (ideal) functions are always analytic continuations of the
(ideal) functions of the same name over the reals.  (That is, the ones in
Ada.Numerics.Generic_Elementary_Functions.)  It would be good to make this
principle explicit somewhere, ideally somewhere preceding the statements in
G.1.2(12) and G.1.2(20).

By "for all practical purposes" I mean: the remaining ambiguity is removable by
adding the subsidiary principle that branch cuts are always subsets of the real
or the imaginary axis.  This is "intuitively obvious" in some sense but is
perhaps worth stating explicitly for the sake of complete clarity.

The quibble I mentioned is with this paragraph:

>These rules are puzzling, because the natural mathematical definition of
>Arcsin and Arccos is such that the real part is continuous; it is the
>imaginary part which has branch cuts.  Similarly, the natural mathematical
>definition of Arcsinh is such that the imaginary part is continuous; it is the
>real part which has branch cuts.

I'm pretty sure I know what is meant here by extending the notion of "branch
cut" to real-valued functions.  I'm dubious about whether this is the right way
to do so.  For example, the real part of arccos is continuous but not
differentiable across its cut: its behavior is like that of abs(x) at x=0.  For
any chosen function among those under discussion (call it 'f'), there is never
an analytic function in any neighborhood straddling a branch cut of f whose
real part matches f's real part.  So, I'd prefer to let "branch cut" apply only
to analytic functions.

****************************************************************

From: Pascal Leroy
Sent: Wednesday, December 13, 2000 4:15 AM
Subject: Re: [Ada-Comment] AI-00185

> I had this significant difficulty: though I agree with the fixes, the RM
> language as it stands doesn't imply that the fixes are the right ones. Nor
> does the Ada 95 Rationale provide any help.

Agreed.  I looked for guidance in these documents, and couldn't find any, so
I had to go back to the math textbooks.

> There is, however, a simple
> principle that would make all cases unambiguous for all practical purposes:
> namely, that the (ideal) functions are always analytic continuations of the
> (ideal) functions of the same name over the reals.  (That is, the ones in
> Ada.Numerics.Generic_Elementary_Functions.)  It would be good to make this
> principle explicit somewhere, ideally somewhere preceding the statements in
> G.1.2(12) and G.1.2(20).

Agreed.

> By "for all practical purposes" I mean: the remaining ambiguity is removable
> by adding the subsidiary principle that branch cuts are always subsets of the
> real or the imaginary axis.  This is "intuitively obvious" in some sense but
> is perhaps worth stating explicitly for the sake of complete clarity.

If a complex function is (1) analytic and (2) an extension of the real
function with the same name, you can _prove_ the following:

1 - The branch cuts are invariant by complex conjugation.
2 - For odd functions the branch cuts are invariant by reflection in the
origin.
3 - The branch cuts begin and end at the points where the function has no
Taylor/Laurent series expansion.

For the functions at hand, this pretty much constrains the cuts to lie on
the axes.  So it seems to me that your "subsidiary principle" is
unnecessary.

> >These rules are puzzling, because the natural mathematical definition of
> >Arcsin and Arccos is such that the real part is continuous; it is the
> >imaginary part which has branch cuts.  Similarly, the natural mathematical
> >definition of Arcsinh is such that the imaginary part is continuous; it is
> > the real part which has branch cuts.
>
> I'm pretty sure I know what is meant here by extending the notion of "branch
> cut" to real-valued functions.  I'm dubious about whether this is the right
> way to do so.  For example, the real part of arccos is continuous but not
> differentiable across its cut: its behavior is like that of abs(x) at x=0.
> For any chosen function among those under discussion (call it 'f'), there is
> never an analytic function in any neighborhood straddling a branch cut of f
> whose real part matches f's real part.  So, I'd prefer to let "branch cut"
> apply only to analytic functions.

I understand the argument that we should not apply the words "branch cut" to
a function which is not analytic, and surely the real/imaginary parts of
these function aren't.  How about replacing "has branch cuts" by "is
discontinuous" in the above paragraph.  I.e.:

"These rules are puzzling, because the natural mathematical definition of
Arcsin and Arccos is such that the real part is continuous; it is the
imaginary part which is discontinuous.  Similarly, the natural mathematical
definition of Arcsinh is such that the imaginary part is continuous; it is
the real part which is discontinuous."

Note that at some point I tried to spell out what I meant by "natural
mathematical definition" (essentially the definition based on the complex
logarithm) but I gave up because of the difficulty of writing complicated
mathematical formulas in a plain text file.

****************************************************************

Questions? Ask the ACAA Technical Agent