Changeset cb1a5d41baf9d4db12a2563a230d0a1e55c8adea
- Timestamp:
- 04/09/12 08:52:08 (14 months ago)
- Author:
- Raymond Toy <rtoy@…>
- Children:
- f8943af6bff60e23d679089db5207b4834aa83ff
- Parents:
- 6cfb0ac4b6bcc1a25bc119e87fd2b57bfa1f4355
- git-committer:
- Raymond Toy <rtoy@…> (04/09/12 08:52:08)
- Message:
-
Fix some mistakes in exp-integral-e when changing algorithm to use
series.
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r6cfb0a
|
rcb1a5d
|
|
| 533 | 533 | ;; |
| 534 | 534 | ;; |
| 535 | | (let* ((prec (float-contagion v z)) |
| 536 | | (v (apply-contagion v prec)) |
| 537 | | (z (apply-contagion z prec))) |
| | 535 | (with-floating-point-contagion (v z) |
| 538 | 536 | (cond ((and (realp v) (minusp v)) |
| 539 | 537 | ;; E(-v, z) = z^(-v-1)*incomplete_gamma_tail(v+1,z) |
| … |
… |
|
| 541 | 539 | (* (expt z (- v 1)) |
| 542 | 540 | (incomplete-gamma-tail (+ -v 1) z)))) |
| 543 | | ((< (abs z) 1) |
| 544 | | ;; Use series for small z |
| | 541 | ((or (< (abs z) 1) (>= (abs (phase z)) 3.1)) |
| | 542 | ;; Use series for small z or if z is near the negative real |
| | 543 | ;; axis because the continued fraction does not converge on |
| | 544 | ;; the negative axis and converges slowly near the negative |
| | 545 | ;; axis. |
| 545 | 546 | (s-exp-integral-e v z)) |
| 546 | | ((>= (abs (phase z)) 3.1) |
| 547 | | ;; The continued fraction doesn't converge on the negative |
| 548 | | ;; real axis, and converges very slowly near the negative |
| 549 | | ;; real axis, so use the incomplete-gamma-tail function in |
| 550 | | ;; this region. "Closeness" to the negative real axis is |
| 551 | | ;; teken to mean that z is in a sector near the axis. |
| 552 | | ;; |
| 553 | | ;; E(v,z) = z^(v-1)*incomplete_gamma_tail(1-v,z) |
| 554 | | (* (expt z (- v 1)) |
| 555 | | (incomplete-gamma-tail (+ -v 1) z)))) |
| 556 | | ((or (< (abs z) 1) (>= (abs (phase z)) 3.1)) |
| 557 | | ;; Use series for small z or if z is near the negative real |
| 558 | | ;; axis because the continued fraction does not converge on |
| 559 | | ;; the negative axis and converges slowly near the negative |
| 560 | | ;; axis. |
| 561 | | (s-exp-integral-e v z)) |
| 562 | | (t |
| 563 | | ;; Use continued fraction for everything else. |
| 564 | | (cf-exp-integral-e v z)))) |
| | 547 | (t |
| | 548 | ;; Use continued fraction for everything else. |
| | 549 | (cf-exp-integral-e v z))))) |
| 565 | 550 | |
| 566 | 551 | ;; Series for Fresnel S |