Commit e10e402d446339130042607357b0129b35a1faa7

Authored by Raymond Toy
1 parent 1d9ec007

Correct the computation of s-exp-integral-e when v is an integer. Add

tests.
Showing 2 changed files with 22 additions and 10 deletions
... ... @@ -501,16 +501,14 @@
(- (* (/ (expt -z (- v 1))
(gamma v))
(- (psi v) (log z)))
(loop for k from 0 below n
for term = 1 then (* term (/ -z k))
for sum = (/ (- 1 v)) then (+ sum (/ term (+ k 1 -v)))
when (< (abs term) (* (abs sum) eps))
return sum)
(loop for k from n
for term = 1 then (* term (/ -z k))
for sum = 0 then (+ sum (/ term (+ k 1 -v)))
when (< (abs term) (* (abs sum) eps))
return sum)))
(loop for k from 0
for term = 1 then (* term (/ -z k))
for sum = (/ (- 1 v)) then (+ sum (let ((denom (+ k 1 (- n))))
(if (zerop denom)
0
(/ term (+ k 1 -v)))))
when (< (abs term) (* (abs sum) eps))
return sum)))
(loop for k from 0
for term = 1 then (* term (/ -z k))
for sum = (/ (- 1 v)) then (+ sum (/ term (+ k 1 -v)))
... ...
... ... @@ -1464,3 +1464,17 @@
(expt x 4))))
(check-accuracy 210.8 e true))
nil)
(rt:deftest expintegral-e.5d
(let* ((x .5d0)
(e (exp-integral-e 2d0 x))
(true #q0.3266438623245530177304015653336378358284946903290101))
(check-accuracy 51.2 e true))
nil)
(rt:deftest expintegral-e.5q
(let* ((x #q.5)
(e (exp-integral-e #q2 x))
(true #q0.326643862324553017730401565333637835828494690329010198058745549181386569998611289568))
(check-accuracy 208.4 e true))
nil)
\ No newline at end of file
... ...