/[emacs]/emacs/lisp/calc/calc-funcs.el
ViewVC logotype

Diff of /emacs/lisp/calc/calc-funcs.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by walters, Wed Nov 14 09:04:22 2001 UTC revision 1.3 by walters, Mon Nov 19 07:34:00 2001 UTC
# Line 1  Line 1 
1  ;; Calculator for GNU Emacs, part II [calc-funcs.el]  ;;; calc-funcs.el --- well-known functions for Calc
2    
3  ;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc.  ;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc.
4  ;; Written by Dave Gillespie, daveg@synaptics.com.  
5    ;; Author: David Gillespie <daveg@synaptics.com>
6    ;; Maintainer: Colin Walters <walters@debian.org>
7    
8  ;; This file is part of GNU Emacs.  ;; This file is part of GNU Emacs.
9    
# Line 19  Line 22 
22  ;; file named COPYING.  Among other things, the copyright notice  ;; file named COPYING.  Among other things, the copyright notice
23  ;; and this notice must be preserved on all copies.  ;; and this notice must be preserved on all copies.
24    
25    ;;; Commentary:
26    
27    ;;; Code:
28    
29  ;; This file is autoloaded from calc-ext.el.  ;; This file is autoloaded from calc-ext.el.
30  (require 'calc-ext)  (require 'calc-ext)
# Line 198  Line 203 
203    
204  ;;; Incomplete gamma function.  ;;; Incomplete gamma function.
205    
206    (defvar math-current-gamma-value nil)
207  (defun calcFunc-gammaP (a x)  (defun calcFunc-gammaP (a x)
208    (if (equal x '(var inf var-inf))    (if (equal x '(var inf var-inf))
209        '(float 1 0)        '(float 1 0)
# Line 248  Line 254 
254            (math-inc-gamma-series a x)            (math-inc-gamma-series a x)
255          (math-sub (or math-current-gamma-value (calcFunc-gamma a))          (math-sub (or math-current-gamma-value (calcFunc-gamma a))
256                    (math-inc-gamma-cfrac a x))))))                    (math-inc-gamma-cfrac a x))))))
 (setq math-current-gamma-value nil)  
257    
258  (defun calcFunc-gammaG (a x)  (defun calcFunc-gammaG (a x)
259    (if (equal x '(var inf var-inf))    (if (equal x '(var inf var-inf))
# Line 371  Line 376 
376    
377  ;;; Incomplete beta function.  ;;; Incomplete beta function.
378    
379    (defvar math-current-beta-value nil)
380  (defun calcFunc-betaI (x a b)  (defun calcFunc-betaI (x a b)
381    (cond ((math-zerop x)    (cond ((math-zerop x)
382           '(float 0 0))           '(float 0 0))
# Line 445  Line 451 
451                      (math-div (math-mul bt                      (math-div (math-mul bt
452                                          (math-beta-cfrac b a (math-sub 1 x)))                                          (math-beta-cfrac b a (math-sub 1 x)))
453                                b))))))))                                b))))))))
 (setq math-current-beta-value nil)  
454    
455  (defun math-beta-cfrac (a b x)  (defun math-beta-cfrac (a b x)
456    (let ((qab (math-add a b))    (let ((qab (math-add a b))
# Line 796  Line 801 
801                      (calcFunc-euler n '(float 5 -1)))                      (calcFunc-euler n '(float 5 -1)))
802                  (calcFunc-euler n '(frac 1 2))))))                  (calcFunc-euler n '(frac 1 2))))))
803    
804    (defvar math-bernoulli-b-cache '((frac -174611
805                                           (bigpos 0 200 291 698 662 857 802))
806                                     (frac 43867 (bigpos 0 944 170 217 94 109 5))
807                                     (frac -3617 (bigpos 0 880 842 622 670 10))
808                                     (frac 1 (bigpos 600 249 724 74))
809                                     (frac -691 (bigpos 0 368 674 307 1))
810                                     (frac 1 (bigpos 160 900 47))
811                                     (frac -1 (bigpos 600 209 1))
812                                     (frac 1 30240) (frac -1 720)
813                                     (frac 1 12) 1 ))
814    
815    (defvar math-bernoulli-B-cache '((frac -174611 330) (frac 43867 798)
816                                     (frac -3617 510) (frac 7 6) (frac -691 2730)
817                                     (frac 5 66) (frac -1 30) (frac 1 42)
818                                     (frac -1 30) (frac 1 6) 1 ))
819    
820    (defvar math-bernoulli-cache-size 11)
821  (defun math-bernoulli-coefs (n)  (defun math-bernoulli-coefs (n)
822    (let* ((coefs (list (calcFunc-bern n)))    (let* ((coefs (list (calcFunc-bern n)))
823           (nn (math-trunc n))           (nn (math-trunc n))
# Line 844  Line 866 
866  ;;; A faster method would be to use "tangent numbers", c.f., Concrete  ;;; A faster method would be to use "tangent numbers", c.f., Concrete
867  ;;; Mathematics pg. 273.  ;;; Mathematics pg. 273.
868    
 (setq math-bernoulli-b-cache '( (frac -174611  
                                       (bigpos 0 200 291 698 662 857 802))  
                                 (frac 43867 (bigpos 0 944 170 217 94 109 5))  
                                 (frac -3617 (bigpos 0 880 842 622 670 10))  
                                 (frac 1 (bigpos 600 249 724 74))  
                                 (frac -691 (bigpos 0 368 674 307 1))  
                                 (frac 1 (bigpos 160 900 47))  
                                 (frac -1 (bigpos 600 209 1))  
                                 (frac 1 30240) (frac -1 720)  
                                 (frac 1 12) 1 ))  
   
 (setq math-bernoulli-B-cache '( (frac -174611 330) (frac 43867 798)  
                                 (frac -3617 510) (frac 7 6) (frac -691 2730)  
                                 (frac 5 66) (frac -1 30) (frac 1 42)  
                                 (frac -1 30) (frac 1 6) 1 ))  
   
 (setq math-bernoulli-cache-size 11)  
   
   
869    
870  ;;; Probability distributions.  ;;; Probability distributions.
871    

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26