;;; calc-funcs.el --- well-known functions for Calc
-;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc.
+;; Copyright (C) 1990, 1991, 1992, 1993, 2001, 2002, 2003, 2004,
+;; 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
;; Author: David Gillespie <daveg@synaptics.com>
-;; Maintainers: D. Goel <deego@gnufans.org>
-;; Colin Walters <walters@debian.org>
+;; Maintainer: Jay Belanger <jay.p.belanger@gmail.com>
;; This file is part of GNU Emacs.
+;; GNU Emacs is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+
;; GNU Emacs is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY. No author or distributor
-;; accepts responsibility to anyone for the consequences of using it
-;; or for whether it serves any particular purpose or works at all,
-;; unless he says so in writing. Refer to the GNU Emacs General Public
-;; License for full details.
-
-;; Everyone is granted permission to copy, modify and redistribute
-;; GNU Emacs, but only under the conditions described in the
-;; GNU Emacs General Public License. A copy of this license is
-;; supposed to have been given to you along with GNU Emacs so you
-;; can know your rights and responsibilities. It should be in a
-;; file named COPYING. Among other things, the copyright notice
-;; and this notice must be preserved on all copies.
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING. If not, write to the
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
;;; Commentary:
;;; Code:
;; This file is autoloaded from calc-ext.el.
-(require 'calc-ext)
+(require 'calc-ext)
(require 'calc-macs)
-(defun calc-Need-calc-funcs () nil)
-
-
(defun calc-inc-gamma (arg)
(interactive "P")
(calc-slow-wrapper
(or (math-numberp x) (math-reject-arg x 'numberp))
(calcFunc-fact (math-add x -1)))
-(defun math-gammap1-raw (x &optional fprec nfprec) ; compute gamma(1 + x)
+(defun math-gammap1-raw (x &optional fprec nfprec)
+ "Compute gamma(1+X) to the appropriate precision."
(or fprec
(setq fprec (math-float calc-internal-prec)
nfprec (math-float (- calc-internal-prec))))
((Math-lessp '(float 8 0) (math-abs-approx x))
(let* ((z (math-div '(float 8 0) x))
(y (math-sqr z))
- (xx (math-add x '(float (bigneg 164 398 785) -9)))
+ (xx (math-add x
+ (math-read-number-simple "-0.785398164")))
(a1 (math-poly-eval y
- '((float (bigpos 211 887 093 2) -16)
- (float (bigneg 639 370 073 2) -15)
- (float (bigpos 407 510 734 2) -14)
- (float (bigneg 627 628 098 1) -12)
- (float 1 0))))
+ (list
+ (math-read-number-simple "0.0000002093887211")
+ (math-read-number-simple "-0.000002073370639")
+ (math-read-number-simple "0.00002734510407")
+ (math-read-number-simple "-0.001098628627")
+ '(float 1 0))))
(a2 (math-poly-eval y
- '((float (bigneg 152 935 934) -16)
- (float (bigpos 161 095 621 7) -16)
- (float (bigneg 651 147 911 6) -15)
- (float (bigpos 765 488 430 1) -13)
- (float (bigneg 995 499 562 1) -11))))
+ (list
+ (math-read-number-simple "-0.0000000934935152")
+ (math-read-number-simple "0.0000007621095161")
+ (math-read-number-simple "-0.000006911147651")
+ (math-read-number-simple "0.0001430488765")
+ (math-read-number-simple "-0.01562499995"))))
(sc (math-sin-cos-raw xx)))
(if yflag
(setq sc (cons (math-neg (cdr sc)) (car sc))))
(math-mul (math-sqrt
- (math-div '(float (bigpos 722 619 636) -9) x))
+ (math-div (math-read-number-simple "0.636619722")
+ x))
(math-sub (math-mul (cdr sc) a1)
(math-mul (car sc) (math-mul z a2))))))
(t
(let ((y (math-sqr x)))
(math-div (math-poly-eval y
- '((float (bigneg 456 052 849 1) -7)
- (float (bigpos 017 233 739 7) -5)
- (float (bigneg 418 442 121 1) -2)
- (float (bigpos 407 196 516 6) -1)
- (float (bigneg 354 590 362 13) 0)
- (float (bigpos 574 490 568 57) 0)))
+ (list
+ (math-read-number-simple "-184.9052456")
+ (math-read-number-simple "77392.33017")
+ (math-read-number-simple "-11214424.18")
+ (math-read-number-simple "651619640.7")
+ (math-read-number-simple "-13362590354.0")
+ (math-read-number-simple "57568490574.0")))
(math-poly-eval y
- '((float 1 0)
- (float (bigpos 712 532 678 2) -7)
- (float (bigpos 853 264 927 5) -5)
- (float (bigpos 718 680 494 9) -3)
- (float (bigpos 985 532 029 1) 0)
- (float (bigpos 411 490 568 57) 0))))))))
+ (list
+ '(float 1 0)
+ (math-read-number-simple "267.8532712")
+ (math-read-number-simple "59272.64853")
+ (math-read-number-simple "9494680.718")
+ (math-read-number-simple "1029532985.0")
+ (math-read-number-simple "57568490411.0"))))))))
(defun math-besJ1 (x &optional yflag)
(cond ((and (math-negp (calcFunc-re x)) (not yflag))
((Math-lessp '(float 8 0) (math-abs-approx x))
(let* ((z (math-div '(float 8 0) x))
(y (math-sqr z))
- (xx (math-add x '(float (bigneg 491 194 356 2) -9)))
+ (xx (math-add x (math-read-number-simple "-2.356194491")))
(a1 (math-poly-eval y
- '((float (bigneg 019 337 240) -15)
- (float (bigpos 174 520 457 2) -15)
- (float (bigneg 496 396 516 3) -14)
- (float 183105 -8)
- (float 1 0))))
+ (list
+ (math-read-number-simple "-0.000000240337019")
+ (math-read-number-simple "0.000002457520174")
+ (math-read-number-simple "-0.00003516396496")
+ '(float 183105 -8)
+ '(float 1 0))))
(a2 (math-poly-eval y
- '((float (bigpos 412 787 105) -15)
- (float (bigneg 987 228 88) -14)
- (float (bigpos 096 199 449 8) -15)
- (float (bigneg 873 690 002 2) -13)
- (float (bigpos 995 499 687 4) -11))))
+ (list
+ (math-read-number-simple "0.000000105787412")
+ (math-read-number-simple "-0.00000088228987")
+ (math-read-number-simple "0.000008449199096")
+ (math-read-number-simple "-0.0002002690873")
+ (math-read-number-simple "0.04687499995"))))
(sc (math-sin-cos-raw xx)))
(if yflag
(setq sc (cons (math-neg (cdr sc)) (car sc)))
(if (math-negp x)
(setq sc (cons (math-neg (car sc)) (math-neg (cdr sc))))))
- (math-mul (math-sqrt (math-div '(float (bigpos 722 619 636) -9) x))
+ (math-mul (math-sqrt (math-div
+ (math-read-number-simple "0.636619722")
+ x))
(math-sub (math-mul (cdr sc) a1)
(math-mul (car sc) (math-mul z a2))))))
(t
(math-mul
x
(math-div (math-poly-eval y
- '((float (bigneg 606 036 016 3) -8)
- (float (bigpos 826 044 157) -4)
- (float (bigneg 439 611 972 2) -3)
- (float (bigpos 531 968 423 2) -1)
- (float (bigneg 235 059 895 7) 0)
- (float (bigpos 232 614 362 72) 0)))
+ (list
+ (math-read-number-simple "-30.16036606")
+ (math-read-number-simple "15704.4826")
+ (math-read-number-simple "-2972611.439")
+ (math-read-number-simple "242396853.1")
+ (math-read-number-simple "-7895059235.0")
+ (math-read-number-simple "72362614232.0")))
(math-poly-eval y
- '((float 1 0)
- (float (bigpos 397 991 769 3) -7)
- (float (bigpos 394 743 944 9) -5)
- (float (bigpos 474 330 858 1) -2)
- (float (bigpos 178 535 300 2) 0)
- (float (bigpos 442 228 725 144)
- 0)))))))))
+ (list
+ '(float 1 0)
+ (math-read-number-simple "376.9991397")
+ (math-read-number-simple "99447.43394")
+ (math-read-number-simple "18583304.74")
+ (math-read-number-simple "2300535178.0")
+ (math-read-number-simple "144725228442.0")))))))))
(defun calcFunc-besY (v x)
(math-inexact-result)
(defun math-besY0 (x)
(cond ((Math-lessp (math-abs-approx x) '(float 8 0))
(let ((y (math-sqr x)))
- (math-add
+ (math-add
(math-div (math-poly-eval y
- '((float (bigpos 733 622 284 2) -7)
- (float (bigneg 757 792 632 8) -5)
- (float (bigpos 129 988 087 1) -2)
- (float (bigneg 036 598 123 5) -1)
- (float (bigpos 065 834 062 7) 0)
- (float (bigneg 389 821 957 2) 0)))
+ (list
+ (math-read-number-simple "228.4622733")
+ (math-read-number-simple "-86327.92757")
+ (math-read-number-simple "10879881.29")
+ (math-read-number-simple "-512359803.6")
+ (math-read-number-simple "7062834065.0")
+ (math-read-number-simple "-2957821389.0")))
(math-poly-eval y
- '((float 1 0)
- (float (bigpos 244 030 261 2) -7)
- (float (bigpos 647 472 474) -4)
- (float (bigpos 438 466 189 7) -3)
- (float (bigpos 648 499 452 7) -1)
- (float (bigpos 269 544 076 40) 0))))
- (math-mul '(float (bigpos 772 619 636) -9)
+ (list
+ '(float 1 0)
+ (math-read-number-simple "226.1030244")
+ (math-read-number-simple "47447.2647")
+ (math-read-number-simple "7189466.438")
+ (math-read-number-simple "745249964.8")
+ (math-read-number-simple "40076544269.0"))))
+ (math-mul (math-read-number-simple "0.636619772")
(math-mul (math-besJ0 x) (math-ln-raw x))))))
((math-negp (calcFunc-re x))
(math-add (math-besJ0 (math-neg x) t)
(math-mul
x
(math-div (math-poly-eval y
- '((float (bigpos 935 937 511 8) -6)
- (float (bigneg 726 922 237 4) -3)
- (float (bigpos 551 264 349 7) -1)
- (float (bigneg 139 438 153 5) 1)
- (float (bigpos 439 527 127) 4)
- (float (bigneg 943 604 900 4) 3)))
+ (list
+ (math-read-number-simple "8511.937935")
+ (math-read-number-simple "-4237922.726")
+ (math-read-number-simple "734926455.1")
+ (math-read-number-simple "-51534381390.0")
+ (math-read-number-simple "1275274390000.0")
+ (math-read-number-simple "-4900604943000.0")))
(math-poly-eval y
- '((float 1 0)
- (float (bigpos 885 632 549 3) -7)
- (float (bigpos 605 042 102) -3)
- (float (bigpos 002 904 245 2) -2)
- (float (bigpos 367 650 733 3) 0)
- (float (bigpos 664 419 244 4) 2)
- (float (bigpos 057 958 249) 5)))))
- (math-mul '(float (bigpos 772 619 636) -9)
- (math-sub (math-mul (math-besJ1 x) (math-ln-raw x))
+ (list
+ '(float 1 0)
+ (math-read-number-simple "354.9632885")
+ (math-read-number-simple "102042.605")
+ (math-read-number-simple "22459040.02")
+ (math-read-number-simple "3733650367.0")
+ (math-read-number-simple "424441966400.0")
+ (math-read-number-simple "24995805700000.0")))))
+ (math-mul (math-read-number-simple "0.636619772")
+ (math-sub (math-mul (math-besJ1 x) (math-ln-raw x))
(math-div 1 x))))))
((math-negp (calcFunc-re x))
(math-neg
(calcFunc-euler n '(float 5 -1)))
(calcFunc-euler n '(frac 1 2))))))
-(defvar 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 ))
-
-(defvar 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 ))
+(defvar math-bernoulli-b-cache
+ (list
+ (list 'frac
+ -174611
+ (math-read-number-simple "802857662698291200000"))
+ (list 'frac
+ 43867
+ (math-read-number-simple "5109094217170944000"))
+ (list 'frac
+ -3617
+ (math-read-number-simple "10670622842880000"))
+ (list 'frac
+ 1
+ (math-read-number-simple "74724249600"))
+ (list 'frac
+ -691
+ (math-read-number-simple "1307674368000"))
+ (list 'frac
+ 1
+ (math-read-number-simple "47900160"))
+ (list 'frac
+ -1
+ (math-read-number-simple "1209600"))
+ (list 'frac
+ 1
+ 30240)
+ (list 'frac
+ -1
+ 720)
+ (list 'frac
+ 1
+ 12)
+ 1 ))
+
+(defvar 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 ))
(defvar math-bernoulli-cache-size 11)
(defun math-bernoulli-coefs (n)
(math-sub 1 (calcFunc-utpt tt v)))
(put 'calcFunc-ltpt 'math-expandable t)
+(provide 'calc-funcs)
;;; arch-tag: 421ddb7a-550f-4dda-a31c-06638ebfc43a
;;; calc-funcs.el ends here