This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Improved complex acosh and asinh functions
Type: Stage:
Components: None Versions:
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: gvanrossum Nosy List: gvanrossum, tim.peters
Priority: normal Keywords: patch

Created on 2000-06-27 20:42 by gvanrossum, last changed 2022-04-10 16:02 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
None gvanrossum, 2000-06-27 20:42 None
Messages (4)
msg32878 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2000-06-27 20:42
 
msg32879 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2000-06-27 20:44
This was originally submitted by  Nadav Horesh <nadavh@envision.co.il>.

Tim, I have a document for you, but it's in TeX. Do you want the raw TeX source or can you read a DVI file?
msg32880 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2000-06-30 02:29
Checked in now.
msg32881 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2000-06-29 23:29
Accepted (but reluctantly; see below), and assigned back to Guido for checkin.

cmathmodule is not production quality, and this patch isn't either, but its asinh and acosh are better than what's there now.

The author avoided some of the numerical foolishness in the original, but didn't avoid all of it.  For example, it's harder to get asinh to do something ridiculous now than it was before, but still possible:

>>> cmath.acosh(1e200)
(461.210165779+0j)
>>> cmath.asinh(1e200)
(1.#INF+0j)
>>>

asinh should have returned something approximately equal to what acosh returned.

That may not be the patch's problem, though!  I suspect that's due to one of the module's other functions that's too naive about the limits of floating point.  In any case, it is *much* easier to provoke the current cmath functions into cases like this one.

Another possible problem has to do with principal values.  My reference books are in storage, so about the best I can do right now is compare what this code does to Macsyma (which I have on my laptop).  The acosh in this patch often returns the negative of what Macysma computes.  For example,

>>> cmath.acosh(-1-1j)
(1.06127506191-2.23703575929j)
>>>

Macsyma returns the negation of that.  On the other hand, the *original* acosh doesn't agree with Macsyma on some signs where this acosh does.  So call this one a wash.

I may have mentioned this before <wink>:  robust math libraries are extremely difficult to get right.  It would take several months to write a production-quality cmath module from scratch, which is several months more than were devoted to Python's current cmath <wink>.  I vote we check this in anyway (since it *is*, overall, an improvement), and look into borrowing some other language's complex math library later (note in particular that C9X adds complex numbers and these functions on them, so if we sit on our asses long enough, we can inherit libc's!).
History
Date User Action Args
2022-04-10 16:02:01adminsetgithub: 32469
2000-06-27 20:42:28gvanrossumcreate