Changeset cb1a5d


Ignore:
Timestamp:
04/09/12 15:52:08 (3 years ago)
Author:
Raymond Toy <rtoy@…>
Branches:
master
Children:
f8943a
Parents:
6cfb0a
Message:

Fix some mistakes in exp-integral-e when changing algorithm to use
series.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • qd-gamma.lisp

    r6cfb0a rcb1a5d  
    533533  ;;
    534534  ;;
    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)
    538536    (cond ((and (realp v) (minusp v))
    539537           ;; E(-v, z) = z^(-v-1)*incomplete_gamma_tail(v+1,z)
     
    541539             (* (expt z (- v 1))
    542540                (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.
    545546           (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)))))
    565550
    566551;; Series for Fresnel S
Note: See TracChangeset for help on using the changeset viewer.