Raymond Toy pushed to branch rtoy-issue-78-unneded-code-code-in-complex-acos at cmucl / cmucl
Commits:
00d0cb6f by Raymond Toy at 2020-05-24T10:17:44-07:00
Derive the values on the branch cuts for acosh
Conclusion: on the branch cuts, acosh is continuous with quadrant I
for 9 <= x < 1 and with 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
=====================================
@@ -1726,6 +1726,46 @@ Z may be any number, but the result is always a complex."
(asinh (imagpart (* (conjugate sqrt-1+z)
sqrt-1-z))))))))
+;; acosh(z) = 2*log(sqrt((x+1)/2) + sqrt((x-1)/2))
+;;
+;; For z = x, 0 <= x < 1
+;; acosh(z) = 2*log(sqrt((x+1)/2) + sqrt((x-1)/2))
+;; = 2*log(sqrt((x+1)/2) + i*sqrt((1-x)/2))
+;; = 2*(log(1) + i*arg(sqrt((x+1)/2) + i*sqrt((1-x)/2)))
+;; = 2*i*atan(sqrt((1-x)/2), sqrt((x+1)/2))
+;; = 2*i*atan(sqrt((1-x)/(1+x)))
+;;
+;; For z = -x, x > 1
+;; acosh(z) = 2*log(sqrt((1-x)/2) + sqrt((-x-1)/2))
+;; = 2*log((i*sqrt((x-1)/2) + 0 + i*sqrt((1+x)/2)) + 0)
+;; = 2*log(i*(sqrt((x-1)/2) + sqrt((1+x)/2)) + 0)
+;; = 2*(log(sqrt((x-1)/2) + sqrt((1+x)/2)) + i*arg(sqrt((x-1)/2) + sqrt((1+x)/2)) + 0)
+;; = 2*(log(sqrt((x-1)/2) + sqrt((1+x)/2)) + i*pi/2)
+;; = 2*log(x+sqrt(x+1)*sqrt(x-1)) + i*pi
+;;
+;; For z = x + i0, 0 <= x < 1
+;; acosh(z) = 2*log(sqrt((1+x)/2+i0) + sqrt((x-1)/2+i0))
+;; = 2*log(sqrt((1+x)/2)+i0 + i*sqrt((1-x)/2) + 0)
+;; = 2*log(sqrt((1+x)/2) + i*sqrt((1-x)/2))
+;; = 2*(log(1) + i*arg(sqrt((1+x)/2) + i*sqrt((1-x)/2))
+;; = 0 + 2*i*atan(sqrt((1-x)/2)/sqrt((1+x)/2)) +
+;; = 0 + 2*i*atan(sqrt((1-x)/(1+x))
+;;
+;; This is the same value we got for acosh(x), 0 <= x < 1. Hence,
+;; acosh is continuous with quadrant I on the branch cut for 0 <= x <
+;; 1.
+;;
+;; Finally, for z = -x + i0, x > 1
+;; acosh(z) = 2*log(sqrt((1-x)/2+i0) + sqrt((-x-1)/2+i0))
+;; = 2*log(i*sqrt((x-1)/2) + 0 + i*sqrt((1+x)/2 + i0))
+;; = 2*log(i*(sqrt((x-1)/2) + sqrt((1+x)/2)) + 0)
+;; = 2*(log(sqrt((x-1)/2) + sqrt((1+x)/2)) + i*arg(0, (sqrt((x-1)/2) + sqrt((1+x)/2)))
+;; = 2*(log(sqrt((x-1)/2) + sqrt((1+x)/2)) + i*pi/2)
+;; = 2*log(sqrt((x-1)/2) + sqrt((1+x)/2)) + i*pi
+;;
+;; We see that this is the same expression for acosh(z), z < -1.
+;; Hence, acosh(z) is continuous with quadrant II on the branch cut x
+;; < -1.
(defun complex-acosh (z)
"Compute acosh z = 2 * log(sqrt((z+1)/2) + sqrt((z-1)/2))
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/00d0cb6f5f931b01000bef1…
--
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/00d0cb6f5f931b01000bef1…
You're receiving this email because of your account on gitlab.common-lisp.net.
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/fe15b0a31119288135a67ab…
--
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/fe15b0a31119288135a67ab…
You're receiving this email because of your account on gitlab.common-lisp.net.
Raymond Toy pushed to branch rtoy-issue-78-unneded-code-code-in-complex-acos at cmucl / cmucl
Commits:
53cf274f by Raymond Toy at 2020-05-23T13:46:52-07:00
Add derivation for the values on the branch cut for acos
We derive formulas for the values of acos(x) for x > 1 and x < -1 and
show that for x > 1, acos is continuous with quadrant IV and for x <
-1, acos is continuous with quadrant II.
This matches Kahan's counter-clockwise countinuity for values on the
branch cuts.
- - - - -
1 changed file:
- src/code/irrat.lisp
Changes:
=====================================
src/code/irrat.lisp
=====================================
@@ -1334,6 +1334,27 @@ and Y are coerced to single-float."
(t
(values rho 0)))))))
+;; sqrt(z) = z^(1/2)
+;; = exp(1/2*log(z))
+;;
+;; Some special values, with x > 0
+;; sqrt(x + i*0) = exp(1/2*log(x+i*0))
+;; = exp(1/2*(log(x)+i*0))
+;; = exp(1/2*log(x)+i*0)
+;; = exp(1/2*log(x))*exp(i*0)
+;; = sqrt(x)*(cos 0 + i*sin(0))
+;; = sqrt(x) + i*0
+;; sqrt(x - i*0) = exp(1/2*log(x-i*0))
+;; = exp(1/2*(log(x) - i*0))
+;; = exp(1/2*log(x) - i*0)
+;; = exp(1/2*log(x))*exp(-i*0)
+;; = sqrt(x)*(cos(-0) + i*sin(-0))
+;; = sqrt(x) - i*0
+;; Kahan also gives the following for b > 0
+;; sqrt(-b+/-i*0) = +0 +/- i*sqrt(b)
+;; sqrt(x +/- i*inf) = +inf +/- i*inf for all finite x.
+;; sqrt(inf +/- i*b) = +inf +/- i*0
+;; sqrt(-inf +/- i*b) = +0 +/- i*inf
(defun complex-sqrt (z)
"Principle square root of Z
@@ -1604,6 +1625,51 @@ Z may be any number, but the result is always a complex."
(+ z 1)
(complex (+ (realpart z) 1) (imagpart z))))
+;; acos(z) = 2*log(sqrt((1+z)/2) + i*sqrt((1-z)/2))/i
+;; = pi/2 - asin(z)
+;;
+;; In particular for z = x > 1:
+;; acos(x) = 2/i*log(sqrt((x+1)/2) + i*sqrt((1-x)/2))
+;; = 2/i*log(sqrt((x+1)/2) + i*i*sqrt((x-1)/2))
+;; = 2/i*log(sqrt((x+1)/2) - sqrt((x-1)/2))
+;; = -2*i*log(sqrt((x+1)/2) - sqrt((x-1)/2))
+;; = -i*log(x-sqrt(x-1)*sqrt(x+1))
+;; Thus, acos(2) = -i*log(2-sqrt(3) = -i*1.31695...
+;;
+;; Similarly for z = -x, x > 1:
+;; acos(-x) = 2/i*log(sqrt((1-x)/2) + i*sart((1+x)/2))
+;; = 2/i*log(i*sqrt((x-1)/2) + i*sqrt((1+x)/2))
+;; = 2/i*log(i*(sqrt((x+1)/2)+sqrt((x-1)/2)))
+;; = 2/i*(log(sqrt((x+1)/2)+sqrt((x-1)/2)) + i*pi/2)
+;; = -i*2*log(sqrt((x+1)/2)+sqrt((x-1)/2)) - pi
+;; = -pi - i*log(x+sqrt(x+1)*(sqrt(x-1)))
+;;
+;; Thus acos(-2) = -pi - i*log(2+sqrt(3)) = -pi -i*1.31695...
+;;
+;; Now see what aacos(x-i0) for x > 1 is:
+;; acos(x-i*0) = 2/i*log(sqrt((x+1)/2-i*0) + i*sqrt((1-x)/2+i*0))
+;; = 2/i*log(sqrt((x+1)/2) -i*0+ i*(0+i*sqrt((x-1)/2)))
+;; = 2/i*log(sqrt((x+1)/2) - sqrt((x-1)/2) - i*0)
+;; = 2/i*[log(sqrt((x+1)/2) - sqrt((x-1)/2)) - i*0]
+;; = -i*[2*log(sqrt((x+1)/2) - sqrt((x-1)/2)) - i*0]
+;; = -i*log(x-sqrt(x-1)*sqrt(x+1)) + 0
+;;
+;; Thus acos(2 - i*0) is the same as acos(2). That is, acos is
+;; continuous with quadrant IV for x > 1.
+;;
+;; For acos(-x+i0), x > 1:
+;; acos(-x+i0) = 2/i*log(sqrt((1-x+i0)/2) + i*sqrt((1+x-i0)/2))
+;; = 2/i*log(sqrt((1-x)/2+i0) + i*sqrt((1+x)/2-i0))
+;; = 2/i*log((i*sqrt((x-1)/2) + 0) + i*(sqrt((1+x)/2)-i0))
+;; = 2/i*log(i*sqrt((x-1)/2) + i*sqrt((1+x)/2) + 0)
+;; = 2/i*log(i*(sqrt((x-1)/2 + sqrt(1+x)/2)) + 0)
+;; = 2/i*(log(sqrt(x+sqrt(x-1)*sqrt(x+1))) + i*pi/2)
+;; = -i*log(x+sqrt(x-1)*sqrt(x+1)) + pi
+;; = pi - i*log(x+sqrt(x-1)*sqrt(x+1))
+;;
+;; Thus acos(-2+i0) = pi - i*log(sqrt(3)+2) = pi -i*1.31695, and this
+;; equal acos(-2). This means acos is continuous with quadrant II.
+;;
(defun complex-acos (z)
"Compute acos z = pi/2 - asin z
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/53cf274f24589c7870593af…
--
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/53cf274f24589c7870593af…
You're receiving this email because of your account on gitlab.common-lisp.net.
Raymond Toy pushed to branch rtoy-issue-76-add-ansi-tests-to-ci at cmucl / cmucl
Commits:
56438ab3 by Raymond Toy at 2020-02-16T09:55:59-08:00
Update to ASDF 3.3.4
- - - - -
00a914c9 by Raymond Toy at 2020-02-17T09:40:10-08:00
Update to use the 2019-06 snapshot
- - - - -
b18f00f2 by Raymond Toy at 2020-02-18T06:24:00+00:00
Fix #79: Autoload ASDF in REQUIRE
When `REQUIRE` is called, autoload ASDF if it hasn't already been
loaded. User's no longer have to load asdf explicitly anymore.
Update release notes.
- - - - -
b219722a by Raymond Toy at 2020-02-18T06:24:00+00:00
Merge branch 'rtoy-issue-79-autoload-asdf' into 'master'
Fix #79: Autoload ASDF in REQUIRE
Closes #79
See merge request cmucl/cmucl!46
- - - - -
338d8606 by Raymond Toy at 2020-02-18T06:25:47+00:00
Fix #80: Convert contribs to use ASDF to load
As it says, convert contribs to use ASDF to load them if possible. Many
contribs already had an asd file so we basically just had to rename
foo.asd to contrib-foo.asd to keep backward compatibility with the old
contrib names. (And update the defsystem name to match.)
Added an asd file for packed-sse2. Unix doesn't work, so it's left alone for now.
- - - - -
99f6534f by Raymond Toy at 2020-02-18T06:25:47+00:00
Merge branch 'rtoy-issue-80-asdfify-contribs' into 'master'
Fix #80: Convert contribs to use ASDF to load
Closes #80
See merge request cmucl/cmucl!47
- - - - -
23d9f60e by Raymond Toy at 2020-02-17T22:33:36-08:00
Update from release logs.
Issue #80 is fixed.
- - - - -
84fd9509 by Raymond Toy at 2020-03-08T17:32:37+00:00
Add utilities by Eric Marsden to contribs
Eric Marsden wrote some useful utilities long ago. Let's add them to
the contrib directory so that we have our own copy of them instead of
depending on emarsden.chez.com/downloads.
We're adding:
* cpc - CPU Performance Counters for Solaris
* ssl-cmucl - interface to SSL streams
* tcp-forwarder - TCP forwarder to redirect TCP connections to another
port on another machine
* xml-rpc - Port of Chris Double's xml-rpc client to Cmucl
- - - - -
d5853cfb by Raymond Toy at 2020-03-08T17:32:37+00:00
Merge branch 'rtoy-add-emarsden-contribs' into 'master'
Fix #81: Add contribs written by Eric Marsden
Closes #81, #80, and #79
See merge request cmucl/cmucl!48
- - - - -
c5ae0bbd by Raymond Toy at 2020-03-17T03:15:24+00:00
Fix #77: Add tests for sqrt of exceptional values
Add tests for the test cases listed in the bug. Cmucl currently
passes with no additional changes.
- - - - -
dcaa51db by Raymond Toy at 2020-03-17T03:15:24+00:00
Merge branch 'rtoy-issue-77-tests-sqrt-exceptional' into 'master'
Fix #77: Add tests for sqrt of exceptional values
Closes #77
See merge request cmucl/cmucl!49
- - - - -
12b02161 by Raymond Toy at 2020-03-22T09:53:25-07:00
Update release notes via closed issues
- - - - -
9d6febd3 by Raymond Toy at 2020-03-25T01:12:38+00:00
Fix #82: Replace bc with expr
`expr` is more commonly installed than `bc` so reduce the number of
required dependencies and just use `expr`.
- - - - -
911f6abe by Raymond Toy at 2020-03-25T01:12:38+00:00
Merge branch 'rtoy-issue-82-replace-bc' into 'master'
Fix #82: Replace bc with expr
Closes #82
See merge request cmucl/cmucl!50
- - - - -
974366fb by Raymond Toy at 2020-03-27T19:47:55-07:00
Use snapshot-2020-04
The snapshot has been release so use the latest snapshot to run the
CI.
- - - - -
9514ed06 by Raymond Toy at 2020-05-02T16:07:11-07:00
Merge branch 'master' into rtoy-issue-76-add-ansi-tests-to-ci
- - - - -
30 changed files:
- .gitlab-ci.yml
- src/code/module.lisp
- src/contrib/asdf/asdf.lisp
- src/contrib/asdf/doc/asdf.html
- src/contrib/asdf/doc/asdf.info
- src/contrib/asdf/doc/asdf.pdf
- src/contrib/contrib.lisp
- + src/contrib/cpc/contrib-cpc.asd
- + src/contrib/cpc/cpc.lisp
- src/contrib/demos/demos.asd → src/contrib/demos/contrib-demos.asd
- src/contrib/embedded-c/embedded-c.asd → src/contrib/embedded-c/contrib-embedded-c.asd
- src/contrib/follow-mouse/follow-mouse.asd → src/contrib/follow-mouse/contrib-follow-mouse.asd
- src/contrib/games/feebs/brains.lisp
- src/contrib/games/feebs/feebs.asd → src/contrib/games/feebs/contrib-games-feebs.asd
- src/contrib/hist/hist.asd → src/contrib/hist/contrib-hist.asd
- src/contrib/hist/hist.lisp
- src/contrib/ops/ops.asd → src/contrib/ops/contrib-ops.asd
- src/contrib/ops/ops-util.lisp
- + src/contrib/packed-sse2/contrib-packed-sse2.asd
- src/contrib/psgraph/psgraph.asd → src/contrib/psgraph/contrib-psgraph.asd
- src/contrib/sprof/sprof.asd → src/contrib/sprof/contrib-sprof.asd
- + src/contrib/ssl-cmucl/contrib-ssl.asd
- + src/contrib/ssl-cmucl/ssl-cmucl.lisp
- + src/contrib/tcp-forwarder/contrib-tcp-forwarder.asd
- + src/contrib/tcp-forwarder/tcp-forwarder.lisp
- + src/contrib/unix/unix.asd
- + src/contrib/xml-rpc/xmlrpc.lisp
- src/general-info/release-21e.md
- src/lisp/GNUmakefile
- tests/irrat.lisp
The diff was not included because it is too large.
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/6f87c065753548029580aa…
--
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/6f87c065753548029580aa…
You're receiving this email because of your account on gitlab.common-lisp.net.