comparison lisp/calc/calcalg2.el @ 58573:87c7dff39cb0

(math-expr-parts, math-try-solve-sign, math-solve-b, math-int-factors) (math-double-roots): Declare them (for real this time).
author Jay Belanger <jay.p.belanger@gmail.com>
date Sat, 27 Nov 2004 04:13:08 +0000
parents 7f5b01c17652
children f4f966b4564d
comparison
equal deleted inserted replaced
58572:03d106fe8857 58573:87c7dff39cb0
1 ;;; calcalg2.el --- more algebraic functions for Calc 1 ;;; calcalg2.el --- more algebraic functions for Calc
2 2
3 ;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc. 3 ;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc.
4 4
5 ;; Author: David Gillespie <daveg@synaptics.com> 5 ;; Author: David Gillespie <daveg@synaptics.com>
6 ;; Maintainers: D. Goel <deego@gnufans.org> 6 ;; Maintainer: Jay Belanger <belanger@truman.edu>
7 ;; Colin Walters <walters@debian.org>
8 7
9 ;; This file is part of GNU Emacs. 8 ;; This file is part of GNU Emacs.
10 9
11 ;; GNU Emacs is distributed in the hope that it will be useful, 10 ;; GNU Emacs is distributed in the hope that it will be useful,
12 ;; but WITHOUT ANY WARRANTY. No author or distributor 11 ;; but WITHOUT ANY WARRANTY. No author or distributor
1317 (car sub-expr) allow-rat))))) 1316 (car sub-expr) allow-rat)))))
1318 res)))) 1317 res))))
1319 1318
1320 ;; The variable math-expr-parts is local to math-expr-rational-in, 1319 ;; The variable math-expr-parts is local to math-expr-rational-in,
1321 ;; but is used by math-expr-rational-in-rec 1320 ;; but is used by math-expr-rational-in-rec
1321 (defvar math-expr-parts)
1322 1322
1323 (defun math-expr-rational-in (expr) 1323 (defun math-expr-rational-in (expr)
1324 (let ((math-expr-parts nil)) 1324 (let ((math-expr-parts nil))
1325 (math-expr-rational-in-rec expr) 1325 (math-expr-rational-in-rec expr)
1326 (mapcar 'car math-expr-parts))) 1326 (mapcar 'car math-expr-parts)))
2277 ;; are local to math-try-solve-for, but are used by math-try-solve-prod. 2277 ;; are local to math-try-solve-for, but are used by math-try-solve-prod.
2278 ;; (math-solve-lhs and math-solve-rhs are is also local to 2278 ;; (math-solve-lhs and math-solve-rhs are is also local to
2279 ;; math-decompose-poly, but used by math-solve-poly-funny-powers.) 2279 ;; math-decompose-poly, but used by math-solve-poly-funny-powers.)
2280 (defvar math-solve-lhs) 2280 (defvar math-solve-lhs)
2281 (defvar math-solve-rhs) 2281 (defvar math-solve-rhs)
2282 (defvar math-try-solve-sign)
2282 2283
2283 (defun math-try-solve-for 2284 (defun math-try-solve-for
2284 (math-solve-lhs math-solve-rhs &optional math-try-solve-sign no-poly) 2285 (math-solve-lhs math-solve-rhs &optional math-try-solve-sign no-poly)
2285 (let (math-t1 math-t2 math-t3) 2286 (let (math-t1 math-t2 math-t3)
2286 (cond ((equal math-solve-lhs math-solve-var) 2287 (cond ((equal math-solve-lhs math-solve-var)
2563 (t lsoln))) 2564 (t lsoln)))
2564 2565
2565 ;;; This deals with negative, fractional, and symbolic powers of "x". 2566 ;;; This deals with negative, fractional, and symbolic powers of "x".
2566 ;; The variable math-solve-b is local to math-decompose-poly, 2567 ;; The variable math-solve-b is local to math-decompose-poly,
2567 ;; but is used by math-solve-poly-funny-powers. 2568 ;; but is used by math-solve-poly-funny-powers.
2569 (defvar math-solve-b)
2568 2570
2569 (defun math-solve-poly-funny-powers (sub-rhs) ; uses "t1", "t2" 2571 (defun math-solve-poly-funny-powers (sub-rhs) ; uses "t1", "t2"
2570 (setq math-t1 math-solve-lhs) 2572 (setq math-t1 math-solve-lhs)
2571 (let ((pp math-poly-neg-powers) 2573 (let ((pp math-poly-neg-powers)
2572 fac) 2574 fac)
2796 ;; but is used by math-poly-newton-root. 2798 ;; but is used by math-poly-newton-root.
2797 (defvar math-int-threshold) 2799 (defvar math-int-threshold)
2798 ;; The variables math-int-scale, math-int-factors and math-double-roots 2800 ;; The variables math-int-scale, math-int-factors and math-double-roots
2799 ;; are local to math-poly-all-roots, but are used by math-poly-integer-root. 2801 ;; are local to math-poly-all-roots, but are used by math-poly-integer-root.
2800 (defvar math-int-scale) 2802 (defvar math-int-scale)
2803 (defvar math-int-factors)
2804 (defvar math-double-roots)
2801 2805
2802 (defun math-poly-all-roots (var p &optional math-factoring) 2806 (defun math-poly-all-roots (var p &optional math-factoring)
2803 (catch 'ouch 2807 (catch 'ouch
2804 (let* ((math-symbolic-solve calc-symbolic-mode) 2808 (let* ((math-symbolic-solve calc-symbolic-mode)
2805 (roots nil) 2809 (roots nil)
3134 ;; but is used by math-solve-system-rec. 3138 ;; but is used by math-solve-system-rec.
3135 (defvar math-solve-vars) 3139 (defvar math-solve-vars)
3136 3140
3137 ;; The variable math-solve-simplifying is local to math-solve-system 3141 ;; The variable math-solve-simplifying is local to math-solve-system
3138 ;; and math-solve-system-rec, but is used by math-solve-system-subst. 3142 ;; and math-solve-system-rec, but is used by math-solve-system-subst.
3143 (defvar math-solve-simplifying)
3139 3144
3140 (defun math-solve-system (exprs math-solve-vars math-solve-full) 3145 (defun math-solve-system (exprs math-solve-vars math-solve-full)
3141 (setq exprs (mapcar 'list (if (Math-vectorp exprs) 3146 (setq exprs (mapcar 'list (if (Math-vectorp exprs)
3142 (cdr exprs) 3147 (cdr exprs)
3143 (list exprs))) 3148 (list exprs)))