[Git][cmucl/cmucl][rtoy-issue-78-unneded-code-code-in-complex-acos] Derive the values on the branch cuts for atanh

Raymond Toy gitlab at common-lisp.net
Sun May 24 15:10:48 UTC 2020



Raymond Toy pushed to branch rtoy-issue-78-unneded-code-code-in-complex-acos at cmucl / cmucl


Commits:
fe15b0a3 by Raymond Toy at 2020-05-24T08:10:39-07:00
Derive the values on the branch cuts for atanh

Conclusion:  atanh is continuous with quadrant Iv for x > 1 and
quadrant II for x < -1.  This, of course, is consistent with Kahan's
coutner-clowkwise continuity principla.

- - - - -


1 changed file:

- src/code/irrat.lisp


Changes:

=====================================
src/code/irrat.lisp
=====================================
@@ -1449,7 +1449,44 @@ Z may be any number, but the result is always a complex."
 ;; +infinity, but the following code returns approx 176 + i*pi/4. The
 ;; reason for the imaginary part is caused by the fact that arg i*y is
 ;; never 0 since we have positive and negative zeroes.
-
+;;
+;; The branch cut for atanh is on the real axis for x < -1 and x > 1.
+;; Let's derive the values on the branch cut.
+;;
+;; atanh(z) = 1/2*(log(1+z)-log(1-z))
+;;
+;; For z = x, x > 1:
+;;   atanh(x) = 1/2*(log(1+x) - log(1-x))
+;;            = 1/2*(log(1+x) - [log(x-1) + i*arg(1-x))
+;;            = 1/2*(log(1+x) - (log(x-1) + i*pi))
+;;            = 1/2*(log(1+x) - log(x-1) _ i*pi)
+;;            = 1/2*log((1+x)/(x-1)) - i*pi/2
+;;
+;; For z = -x, x > 1
+;;   atanh(x) = 1/2*(log(1-x) - log(1+x))
+;;            = 1/2*((log(x-1) + i*arg(1-x)) - log(1+x))
+;;            = 1/2*((log(x-1) + i*pi) - log(1+x))
+;;            = 1/2*(log((x-1)/(x+1)) + i*pi)
+;;            = 1/2*log((x-1)/(x+1)) + i*pi/2
+;;
+;; For z = x - i0, x > 1
+;;  atanh(z) = 1/2*(log(1+x - i0) - log(1-x+i0))
+;;           = 1/2*(log(1+x) + i*arg(1+x,-0) - (log(x-1) + i*arg(1-x, +0)))
+;;           = 1/2*(log(1+x) - i*0 - (log(x-1) + i*pi))
+;;           = 1/2*(log(1+x) - log(x-1) - i*pi)
+;;           = 1/2*log((1+x)/(x-1)) - i*pi/2
+;;
+;; This is the same answer we get for atanh(x), x > 1.  Hence, atanh
+;; is continuous with quadrant IV along the branch cut x > 1.
+;;
+;; Similary, for z = -x + i0, x > 1:
+;;  atanh(z) = 1/2*(log(1-x + i0) - log(1+x-i0))
+;;           = 1/2*((log(x-1) + i*arg(1-x, +0)) - (log(1+x)+i*arg(1+x, -0)))
+;;           = 1/2*(log(x-1) + i*pi - (log(1+x) - i0))
+;;           = 1/2*(log(x-1) - log(1+x) + i*pi)
+;;           = 1/2*log((x-1)/(x+1)) + i*pi/2
+;; This is same answer as atanh(x), x < -1.  Thus, atanh is continuous
+;; with quadrant II on the branch cut for x < -1
 (defun complex-atanh (z)
   "Compute atanh z = (log(1+z) - log(1-z))/2"
   (declare (number z))



View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/fe15b0a31119288135a67ab0a26f65b48e704fe8

-- 
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/fe15b0a31119288135a67ab0a26f65b48e704fe8
You're receiving this email because of your account on gitlab.common-lisp.net.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cmucl-cvs/attachments/20200524/74081a2b/attachment-0001.htm>


More information about the cmucl-cvs mailing list