... |
... |
@@ -1449,7 +1449,44 @@ Z may be any number, but the result is always a complex." |
1449
|
1449
|
;; +infinity, but the following code returns approx 176 + i*pi/4. The
|
1450
|
1450
|
;; reason for the imaginary part is caused by the fact that arg i*y is
|
1451
|
1451
|
;; never 0 since we have positive and negative zeroes.
|
1452
|
|
-
|
|
1452
|
+;;
|
|
1453
|
+;; The branch cut for atanh is on the real axis for x < -1 and x > 1.
|
|
1454
|
+;; Let's derive the values on the branch cut.
|
|
1455
|
+;;
|
|
1456
|
+;; atanh(z) = 1/2*(log(1+z)-log(1-z))
|
|
1457
|
+;;
|
|
1458
|
+;; For z = x, x > 1:
|
|
1459
|
+;; atanh(x) = 1/2*(log(1+x) - log(1-x))
|
|
1460
|
+;; = 1/2*(log(1+x) - [log(x-1) + i*arg(1-x))
|
|
1461
|
+;; = 1/2*(log(1+x) - (log(x-1) + i*pi))
|
|
1462
|
+;; = 1/2*(log(1+x) - log(x-1) _ i*pi)
|
|
1463
|
+;; = 1/2*log((1+x)/(x-1)) - i*pi/2
|
|
1464
|
+;;
|
|
1465
|
+;; For z = -x, x > 1
|
|
1466
|
+;; atanh(x) = 1/2*(log(1-x) - log(1+x))
|
|
1467
|
+;; = 1/2*((log(x-1) + i*arg(1-x)) - log(1+x))
|
|
1468
|
+;; = 1/2*((log(x-1) + i*pi) - log(1+x))
|
|
1469
|
+;; = 1/2*(log((x-1)/(x+1)) + i*pi)
|
|
1470
|
+;; = 1/2*log((x-1)/(x+1)) + i*pi/2
|
|
1471
|
+;;
|
|
1472
|
+;; For z = x - i0, x > 1
|
|
1473
|
+;; atanh(z) = 1/2*(log(1+x - i0) - log(1-x+i0))
|
|
1474
|
+;; = 1/2*(log(1+x) + i*arg(1+x,-0) - (log(x-1) + i*arg(1-x, +0)))
|
|
1475
|
+;; = 1/2*(log(1+x) - i*0 - (log(x-1) + i*pi))
|
|
1476
|
+;; = 1/2*(log(1+x) - log(x-1) - i*pi)
|
|
1477
|
+;; = 1/2*log((1+x)/(x-1)) - i*pi/2
|
|
1478
|
+;;
|
|
1479
|
+;; This is the same answer we get for atanh(x), x > 1. Hence, atanh
|
|
1480
|
+;; is continuous with quadrant IV along the branch cut x > 1.
|
|
1481
|
+;;
|
|
1482
|
+;; Similary, for z = -x + i0, x > 1:
|
|
1483
|
+;; atanh(z) = 1/2*(log(1-x + i0) - log(1+x-i0))
|
|
1484
|
+;; = 1/2*((log(x-1) + i*arg(1-x, +0)) - (log(1+x)+i*arg(1+x, -0)))
|
|
1485
|
+;; = 1/2*(log(x-1) + i*pi - (log(1+x) - i0))
|
|
1486
|
+;; = 1/2*(log(x-1) - log(1+x) + i*pi)
|
|
1487
|
+;; = 1/2*log((x-1)/(x+1)) + i*pi/2
|
|
1488
|
+;; This is same answer as atanh(x), x < -1. Thus, atanh is continuous
|
|
1489
|
+;; with quadrant II on the branch cut for x < -1
|
1453
|
1490
|
(defun complex-atanh (z)
|
1454
|
1491
|
"Compute atanh z = (log(1+z) - log(1-z))/2"
|
1455
|
1492
|
(declare (number z))
|