Numerical evaluation of the hypergeometric function
Subject: Numerical evaluation of the hypergeometric function
From: Barton Willis
Date: Tue, 4 May 2010 12:55:50 -0500
I committed a patch to nfloat.lisp that should fix this bug. You can repair nfloat.lisp
yourself:
(1) Locate the file nfloat.lisp -- to do this enter load("nfloat.lisp") at a Maxima prompt.
(2) Use a text editor to open nfloat.lisp. Look for the function running-error-hypergeometric.
Replace the function definition with
(defun running-error-hypergeometric (a b x subs bits)
(let ((dig) (d) (f))
;; To do this correctly, we'd need the partial derivatives of the hypergeometric functions
;; with respect the the parameters. Ouch!
(setq a (mapcar #'(lambda (s) (car (running-error-eval s subs bits))) (maxima::margs a)))
(setq b (mapcar #'(lambda (s) (car (running-error-eval s subs bits))) (maxima::margs b)))
(setq x (car (running-error-eval x subs bits)))
(cond ((< (abs x) 0.99)
(multiple-value-setq (f d) (hypergeometric-by-series a b x))
(list f (* (abs f) (expt 10 (- d)))))
(t
(setq dig (ceiling (* bits #.(/ (log 2.0) (log 10.0)))))
(setq a (mapcar 'maxima::to a))
(setq b (mapcar 'maxima::to b))
(setq x (maxima::to x))
(multiple-value-setq (f d) (hypergeometric-float-eval a b x dig t))
(list f (* (abs f) (expt 10 (- d))))))))
(3) At a Maxima prompt, compile the new code:
> load("float.lisp")$
> compile_file(load("hypergeometric.lisp"));
> compile_file(load("nfloat.lisp"));
I didn't test this last step -- it's not necessary (but if nfloat has been compiled,
delete the object code)
Again, thanks for the bug report, and let me know if you find additional bugs in
the hypergeometric code.
--Barton
-----maxima-bounces at math.utexas.edu wrote: -----
>To:?"'Maxima?List'"?<maxima at math.utexas.edu>
>From:?"Anton?Voropaev"?<anton.n.voropaev at gmail.com>
>Sent?by:?maxima-bounces at math.utexas.edu
>Date:?04/30/2010?04:46PM
>Subject:?[Maxima]?Numerical?evaluation?of?the?hypergeometric?function
>
>hypergeometric([-1/4,1/4],[1],16.0/25)?doesn't?work
>_______________________________________________
>Maxima?mailing?list
>Maxima at math.utexas.edu
>http://www.math.utexas.edu/mailman/listinfo/maxima