Commit a974dcf2 authored by Jay Belanger's avatar Jay Belanger
Browse files

calc-alg.el (math-var): Renamed from `var'.

(math-is-polynomial, math-is-poly-rec): Replace `var' with `math-var'.

calcalg2.el (math-var): Renamed from `var'.
(calcFunc-table, math-scan-for-limits): Replace `var' with `math-var'.
parent 24f981c9
2010-10-14 Jay Belanger <>
* calc/calc-alg.el (math-var): Renamed from `var'.
(math-is-polynomial, math-is-poly-rec): Replace `var'
with `math-var'.
* calc/calcalg2.el (math-var): Renamed from `var'.
(calcFunc-table, math-scan-for-limits): Replace `var'
with `math-var'.
2010-10-13 Glenn Morris <>
* subr.el (last): Deal with dotted lists (reported in bug#7174).
......@@ -1659,11 +1659,11 @@
;; math-is-poly-rec.
(defvar math-is-poly-degree)
(defvar math-is-poly-loose)
(defvar var)
(defvar math-var)
(defun math-is-polynomial (expr var &optional math-is-poly-degree math-is-poly-loose)
(defun math-is-polynomial (expr math-var &optional math-is-poly-degree math-is-poly-loose)
(let* ((math-poly-base-variable (if math-is-poly-loose
(if (eq math-is-poly-loose 'gen) var '(var XXX XXX))
(if (eq math-is-poly-loose 'gen) math-var '(var XXX XXX))
(poly (math-is-poly-rec expr math-poly-neg-powers)))
(and (or (null math-is-poly-degree)
......@@ -1672,11 +1672,11 @@
(defun math-is-poly-rec (expr negpow)
(or (cond ((or (equal expr var)
(or (cond ((or (equal expr math-var)
(eq (car-safe expr) '^))
(let ((pow 1)
(expr expr))
(or (equal expr var)
(or (equal expr math-var)
(setq pow (nth 2 expr)
expr (nth 1 expr)))
(or (eq math-poly-mult-powers 1)
......@@ -1690,7 +1690,7 @@
(equal math-poly-mult-powers
(nth 1 m))
(setq math-poly-mult-powers (nth 1 m)))
(or (equal expr var)
(or (equal expr math-var)
(eq math-poly-mult-powers 1))
(car m)))))
(if (consp pow)
......@@ -1698,7 +1698,7 @@
(setq pow (math-to-simple-fraction pow))
(and (eq (car-safe pow) 'frac)
(equal expr var)
(equal expr math-var)
(setq math-poly-frac-powers
(calcFunc-lcm math-poly-frac-powers
(nth 2 pow))))))
......@@ -1706,10 +1706,10 @@
(setq pow (math-mul pow math-poly-frac-powers)))
(if (integerp pow)
(if (and (= pow 1)
(equal expr var))
(equal expr math-var))
(list 0 1)
(if (natnump pow)
(let ((p1 (if (equal expr var)
(let ((p1 (if (equal expr math-var)
(list 0 1)
(math-is-poly-rec expr nil)))
(n pow)
......@@ -1749,7 +1749,7 @@
(math-poly-mul p1 p2))))))
((eq (car expr) '/)
(and (or (not (math-poly-depends (nth 2 expr) var))
(and (or (not (math-poly-depends (nth 2 expr) math-var))
(and negpow
(math-is-poly-rec (nth 2 expr) nil)
(setq math-poly-neg-powers
......@@ -1759,13 +1759,13 @@
(mapcar (function (lambda (x) (math-div x (nth 2 expr))))
((and (eq (car expr) 'calcFunc-exp)
(equal var '(var e var-e)))
(math-is-poly-rec (list '^ var (nth 1 expr)) negpow))
(equal math-var '(var e var-e)))
(math-is-poly-rec (list '^ math-var (nth 1 expr)) negpow))
((and (eq (car expr) 'calcFunc-sqrt)
(math-is-poly-rec (list '^ (nth 1 expr) '(frac 1 2)) negpow))
(t nil))
(and (or (not (math-poly-depends expr var))
(and (or (not (math-poly-depends expr math-var))
(not (eq (car expr) 'vec))
(list expr)))))
......@@ -1886,9 +1886,9 @@
;; math-scan-for-limits.
(defvar calc-low)
(defvar calc-high)
(defvar var)
(defvar math-var)
(defun calcFunc-table (expr var &optional calc-low calc-high step)
(defun calcFunc-table (expr math-var &optional calc-low calc-high step)
(or calc-low
(setq calc-low '(neg (var inf var-inf)) calc-high '(var inf var-inf)))
(or calc-high (setq calc-high calc-low calc-low 1))
......@@ -1917,7 +1917,7 @@
(math-working-step-2 (1+ count))
(math-working-step 0))
(setq expr (math-evaluate-expr
(math-expr-subst expr var '(var DUMMY var-DUMMY))))
(math-expr-subst expr math-var '(var DUMMY var-DUMMY))))
(while (>= count 0)
(setq math-working-step (1+ math-working-step)
var-DUMMY calc-low
......@@ -1940,7 +1940,7 @@
(calc-record-why 'integerp calc-high))
(calc-record-why 'integerp calc-low)))
(append (list (or math-tabulate-function 'calcFunc-table)
expr var)
expr math-var)
(and (not (and (equal calc-low '(neg (var inf var-inf)))
(equal calc-high '(var inf var-inf))))
(list calc-low calc-high))
......@@ -1950,11 +1950,11 @@
(cond ((Math-primp x))
((and (eq (car x) 'calcFunc-subscr)
(Math-vectorp (nth 1 x))
(math-expr-contains (nth 2 x) var))
(math-expr-contains (nth 2 x) math-var))
(let* ((calc-next-why nil)
(low-val (math-solve-for (nth 2 x) 1 var nil))
(low-val (math-solve-for (nth 2 x) 1 math-var nil))
(high-val (math-solve-for (nth 2 x) (1- (length (nth 1 x)))
var nil))
math-var nil))
(and low-val (math-realp low-val)
high-val (math-realp high-val))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment