+2010-10-14 Jay Belanger <jay.p.belanger@gmail.com>
+
+ * 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 <rgm@gnu.org>
* subr.el (last): Deal with dotted lists (reported in bug#7174).
;; 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))
math-poly-base-variable))
(poly (math-is-poly-rec expr math-poly-neg-powers)))
(and (or (null math-is-poly-degree)
(defun math-is-poly-rec (expr negpow)
(math-poly-simplify
- (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)
(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)
(setq pow (math-to-simple-fraction pow))
(and (eq (car-safe pow) 'frac)
math-poly-frac-powers
- (equal expr var)
+ (equal expr math-var)
(setq math-poly-frac-powers
(calcFunc-lcm math-poly-frac-powers
(nth 2 pow))))))
(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)
math-is-poly-degree))
(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
(mapcar (function (lambda (x) (math-div x (nth 2 expr))))
p1))))
((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-poly-frac-powers)
(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))
math-is-poly-loose)
(not (eq (car expr) 'vec))
(list expr)))))
;; 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))
(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
(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))
(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))
temp)
(and low-val (math-realp low-val)
high-val (math-realp high-val))