(var): Define for compiler.
Delete trailing whitespace.
This commit is contained in:
parent
a9c83b2f0c
commit
f3445fab9f
3 changed files with 108 additions and 101 deletions
|
@ -1,3 +1,8 @@
|
|||
2009-09-19 Glenn Morris <rgm@gnu.org>
|
||||
|
||||
* calc/calc-alg.el (var):
|
||||
* calc/calcalg2.el (var): Define for compiler.
|
||||
|
||||
2009-09-19 Chong Yidong <cyd@stupidchicken.com>
|
||||
|
||||
* emacs-lisp/advice.el (ad-get-argument, ad-set-argument): Doc
|
||||
|
|
|
@ -53,11 +53,11 @@
|
|||
(calc-slow-wrapper
|
||||
(let ((top (calc-top-n 1)))
|
||||
(if (calc-is-inverse)
|
||||
(setq top
|
||||
(setq top
|
||||
(let ((calc-simplify-mode nil))
|
||||
(math-normalize (math-trig-rewrite top)))))
|
||||
(if (calc-is-hyperbolic)
|
||||
(setq top
|
||||
(setq top
|
||||
(let ((calc-simplify-mode nil))
|
||||
(math-normalize (math-hyperbolic-trig-rewrite top)))))
|
||||
(calc-with-default-simplification
|
||||
|
@ -353,7 +353,7 @@
|
|||
(t
|
||||
(mapcar 'math-hyperbolic-trig-rewrite fn))))
|
||||
|
||||
;; math-top-only is local to math-simplify, but is used by
|
||||
;; math-top-only is local to math-simplify, but is used by
|
||||
;; math-simplify-step, which is called by math-simplify.
|
||||
(defvar math-top-only)
|
||||
|
||||
|
@ -456,7 +456,7 @@
|
|||
aaa temp)
|
||||
(while (memq (car-safe (setq aaa (nth 1 aa))) '(+ -))
|
||||
(if (setq temp (math-combine-sum (nth 2 aaa) (nth 2 math-simplify-expr)
|
||||
(eq (car aaa) '-)
|
||||
(eq (car aaa) '-)
|
||||
(eq (car math-simplify-expr) '-) t))
|
||||
(progn
|
||||
(setcar (cdr (cdr math-simplify-expr)) temp)
|
||||
|
@ -499,7 +499,7 @@
|
|||
(setcar (cdr math-simplify-expr) (math-mul (nth 1 math-simplify-expr) temp))))
|
||||
(while (and (eq (car-safe (setq aaa (nth 2 aa))) '*)
|
||||
safe)
|
||||
(if (setq temp (math-combine-prod (nth 1 math-simplify-expr)
|
||||
(if (setq temp (math-combine-prod (nth 1 math-simplify-expr)
|
||||
(nth 1 aaa) nil nil t))
|
||||
(progn
|
||||
(setcar (cdr math-simplify-expr) temp)
|
||||
|
@ -513,7 +513,7 @@
|
|||
(setcar (cdr (cdr aa)) 1)))
|
||||
(if (and (eq (car-safe (nth 1 math-simplify-expr)) 'frac)
|
||||
(memq (nth 1 (nth 1 math-simplify-expr)) '(1 -1)))
|
||||
(math-div (math-mul (nth 2 math-simplify-expr)
|
||||
(math-div (math-mul (nth 2 math-simplify-expr)
|
||||
(nth 1 (nth 1 math-simplify-expr)))
|
||||
(nth 2 (nth 1 math-simplify-expr)))
|
||||
math-simplify-expr)))
|
||||
|
@ -524,18 +524,18 @@
|
|||
(defun math-simplify-divide ()
|
||||
(let ((np (cdr math-simplify-expr))
|
||||
(nover nil)
|
||||
(nn (and (or (eq (car math-simplify-expr) '/)
|
||||
(nn (and (or (eq (car math-simplify-expr) '/)
|
||||
(not (Math-realp (nth 2 math-simplify-expr))))
|
||||
(math-common-constant-factor (nth 2 math-simplify-expr))))
|
||||
n op)
|
||||
(if nn
|
||||
(progn
|
||||
(setq n (and (or (eq (car math-simplify-expr) '/)
|
||||
(setq n (and (or (eq (car math-simplify-expr) '/)
|
||||
(not (Math-realp (nth 1 math-simplify-expr))))
|
||||
(math-common-constant-factor (nth 1 math-simplify-expr))))
|
||||
(if (and (eq (car-safe nn) 'frac) (eq (nth 1 nn) 1) (not n))
|
||||
(progn
|
||||
(setcar (cdr math-simplify-expr)
|
||||
(setcar (cdr math-simplify-expr)
|
||||
(math-mul (nth 2 nn) (nth 1 math-simplify-expr)))
|
||||
(setcar (cdr (cdr math-simplify-expr))
|
||||
(math-cancel-common-factor (nth 2 math-simplify-expr) nn))
|
||||
|
@ -549,7 +549,7 @@
|
|||
(setcar (cdr (cdr math-simplify-expr))
|
||||
(math-cancel-common-factor (nth 2 math-simplify-expr) n))
|
||||
(if (and (math-negp n)
|
||||
(setq op (assq (car math-simplify-expr)
|
||||
(setq op (assq (car math-simplify-expr)
|
||||
calc-tweak-eqn-table)))
|
||||
(setcar math-simplify-expr (nth 1 op))))))))
|
||||
(if (and (eq (car-safe (car np)) '/)
|
||||
|
@ -576,15 +576,15 @@
|
|||
(defvar math-simplify-divisor-nover)
|
||||
(defvar math-simplify-divisor-dover)
|
||||
|
||||
(defun math-simplify-divisor (np dp math-simplify-divisor-nover
|
||||
(defun math-simplify-divisor (np dp math-simplify-divisor-nover
|
||||
math-simplify-divisor-dover)
|
||||
(cond ((eq (car-safe (car dp)) '/)
|
||||
(math-simplify-divisor np (cdr (car dp))
|
||||
math-simplify-divisor-nover
|
||||
(math-simplify-divisor np (cdr (car dp))
|
||||
math-simplify-divisor-nover
|
||||
math-simplify-divisor-dover)
|
||||
(and (math-known-scalarp (nth 1 (car dp)) t)
|
||||
(math-simplify-divisor np (cdr (cdr (car dp)))
|
||||
math-simplify-divisor-nover
|
||||
math-simplify-divisor-nover
|
||||
(not math-simplify-divisor-dover))))
|
||||
((or (or (eq (car math-simplify-expr) '/)
|
||||
(let ((signs (math-possible-signs (car np))))
|
||||
|
@ -594,7 +594,7 @@
|
|||
math-living-dangerously)))
|
||||
(math-numberp (car np)))
|
||||
(let (d
|
||||
(safe t)
|
||||
(safe t)
|
||||
(scalar (math-known-scalarp (car np))))
|
||||
(while (and (eq (car-safe (setq d (car dp))) '*)
|
||||
safe)
|
||||
|
@ -605,10 +605,10 @@
|
|||
(math-simplify-one-divisor np dp))))))
|
||||
|
||||
(defun math-simplify-one-divisor (np dp)
|
||||
(let ((temp (math-combine-prod (car np) (car dp) math-simplify-divisor-nover
|
||||
(let ((temp (math-combine-prod (car np) (car dp) math-simplify-divisor-nover
|
||||
math-simplify-divisor-dover t))
|
||||
op)
|
||||
(if temp
|
||||
(if temp
|
||||
(progn
|
||||
(and (not (memq (car math-simplify-expr) '(/ calcFunc-eq calcFunc-neq)))
|
||||
(math-known-negp (car dp))
|
||||
|
@ -616,7 +616,7 @@
|
|||
(setcar math-simplify-expr (nth 1 op)))
|
||||
(setcar np (if math-simplify-divisor-nover (math-div 1 temp) temp))
|
||||
(setcar dp 1))
|
||||
(and math-simplify-divisor-dover (not math-simplify-divisor-nover)
|
||||
(and math-simplify-divisor-dover (not math-simplify-divisor-nover)
|
||||
(eq (car math-simplify-expr) '/)
|
||||
(eq (car-safe (car dp)) 'calcFunc-sqrt)
|
||||
(Math-integerp (nth 1 (car dp)))
|
||||
|
@ -717,7 +717,7 @@
|
|||
(math-simplify-add-term (cdr (cdr n)) (cdr (cdr math-simplify-expr))
|
||||
(eq (car n) '-) nil)
|
||||
(setq np (cdr n)))
|
||||
(math-simplify-add-term np (cdr (cdr math-simplify-expr)) nil
|
||||
(math-simplify-add-term np (cdr (cdr math-simplify-expr)) nil
|
||||
(eq np (cdr math-simplify-expr)))
|
||||
(math-simplify-divide)
|
||||
(let ((signs (math-possible-signs (cons '- (cdr math-simplify-expr)))))
|
||||
|
@ -784,12 +784,12 @@
|
|||
(and n
|
||||
(math-known-sin (car n) (nth 1 n) '(frac 2 3) 0))))
|
||||
(and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arccos)
|
||||
(list 'calcFunc-sqrt (math-sub 1 (math-sqr
|
||||
(list 'calcFunc-sqrt (math-sub 1 (math-sqr
|
||||
(nth 1 (nth 1 math-simplify-expr))))))
|
||||
(and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arctan)
|
||||
(math-div (nth 1 (nth 1 math-simplify-expr))
|
||||
(list 'calcFunc-sqrt
|
||||
(math-add 1 (math-sqr
|
||||
(math-add 1 (math-sqr
|
||||
(nth 1 (nth 1 math-simplify-expr)))))))
|
||||
(let ((m (math-should-expand-trig (nth 1 math-simplify-expr))))
|
||||
(and m (integerp (car m))
|
||||
|
@ -814,12 +814,12 @@
|
|||
(and n
|
||||
(math-known-sin (car n) (nth 1 n) '(frac 2 3) 300))))
|
||||
(and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arcsin)
|
||||
(list 'calcFunc-sqrt
|
||||
(list 'calcFunc-sqrt
|
||||
(math-sub 1 (math-sqr (nth 1 (nth 1 math-simplify-expr))))))
|
||||
(and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arctan)
|
||||
(math-div 1
|
||||
(list 'calcFunc-sqrt
|
||||
(math-add 1
|
||||
(math-add 1
|
||||
(math-sqr (nth 1 (nth 1 math-simplify-expr)))))))
|
||||
(let ((m (math-should-expand-trig (nth 1 math-simplify-expr))))
|
||||
(and m (integerp (car m))
|
||||
|
@ -842,17 +842,17 @@
|
|||
(and n
|
||||
(math-div 1 (math-known-sin (car n) (nth 1 n) '(frac 2 3) 300)))))
|
||||
(and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arcsin)
|
||||
(math-div
|
||||
(math-div
|
||||
1
|
||||
(list 'calcFunc-sqrt
|
||||
(list 'calcFunc-sqrt
|
||||
(math-sub 1 (math-sqr (nth 1 (nth 1 math-simplify-expr)))))))
|
||||
(and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arccos)
|
||||
(math-div
|
||||
(math-div
|
||||
1
|
||||
(nth 1 (nth 1 math-simplify-expr))))
|
||||
(and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arctan)
|
||||
(list 'calcFunc-sqrt
|
||||
(math-add 1
|
||||
(math-add 1
|
||||
(math-sqr (nth 1 (nth 1 math-simplify-expr))))))))
|
||||
|
||||
(math-defsimplify calcFunc-csc
|
||||
|
@ -869,13 +869,13 @@
|
|||
(and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arcsin)
|
||||
(math-div 1 (nth 1 (nth 1 math-simplify-expr))))
|
||||
(and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arccos)
|
||||
(math-div
|
||||
(math-div
|
||||
1
|
||||
(list 'calcFunc-sqrt (math-sub 1 (math-sqr
|
||||
(list 'calcFunc-sqrt (math-sub 1 (math-sqr
|
||||
(nth 1 (nth 1 math-simplify-expr)))))))
|
||||
(and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arctan)
|
||||
(math-div (list 'calcFunc-sqrt
|
||||
(math-add 1 (math-sqr
|
||||
(math-add 1 (math-sqr
|
||||
(nth 1 (nth 1 math-simplify-expr)))))
|
||||
(nth 1 (nth 1 math-simplify-expr))))))
|
||||
|
||||
|
@ -1021,7 +1021,7 @@
|
|||
(math-neg (list 'calcFunc-sinh (math-neg (nth 1 math-simplify-expr)))))
|
||||
(and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arccosh)
|
||||
math-living-dangerously
|
||||
(list 'calcFunc-sqrt
|
||||
(list 'calcFunc-sqrt
|
||||
(math-sub (math-sqr (nth 1 (nth 1 math-simplify-expr))) 1)))
|
||||
(and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arctanh)
|
||||
math-living-dangerously
|
||||
|
@ -1045,7 +1045,7 @@
|
|||
(list 'calcFunc-cosh (math-neg (nth 1 math-simplify-expr))))
|
||||
(and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arcsinh)
|
||||
math-living-dangerously
|
||||
(list 'calcFunc-sqrt
|
||||
(list 'calcFunc-sqrt
|
||||
(math-add (math-sqr (nth 1 (nth 1 math-simplify-expr))) 1)))
|
||||
(and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arctanh)
|
||||
math-living-dangerously
|
||||
|
@ -1090,9 +1090,9 @@
|
|||
(list 'calcFunc-sech (math-neg (nth 1 math-simplify-expr))))
|
||||
(and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arcsinh)
|
||||
math-living-dangerously
|
||||
(math-div
|
||||
(math-div
|
||||
1
|
||||
(list 'calcFunc-sqrt
|
||||
(list 'calcFunc-sqrt
|
||||
(math-add (math-sqr (nth 1 (nth 1 math-simplify-expr))) 1))))
|
||||
(and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arccosh)
|
||||
math-living-dangerously
|
||||
|
@ -1110,9 +1110,9 @@
|
|||
(math-div 1 (nth 1 (nth 1 math-simplify-expr))))
|
||||
(and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arccosh)
|
||||
math-living-dangerously
|
||||
(math-div
|
||||
(math-div
|
||||
1
|
||||
(list 'calcFunc-sqrt
|
||||
(list 'calcFunc-sqrt
|
||||
(math-sub (math-sqr (nth 1 (nth 1 math-simplify-expr))) 1))))
|
||||
(and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arctanh)
|
||||
math-living-dangerously
|
||||
|
@ -1205,7 +1205,7 @@
|
|||
|
||||
(defun math-simplify-sqrt ()
|
||||
(or (and (eq (car-safe (nth 1 math-simplify-expr)) 'frac)
|
||||
(math-div (list 'calcFunc-sqrt
|
||||
(math-div (list 'calcFunc-sqrt
|
||||
(math-mul (nth 1 (nth 1 math-simplify-expr))
|
||||
(nth 2 (nth 1 math-simplify-expr))))
|
||||
(nth 2 (nth 1 math-simplify-expr))))
|
||||
|
@ -1216,7 +1216,7 @@
|
|||
(math-mul (math-normalize (list 'calcFunc-sqrt fac))
|
||||
(math-normalize
|
||||
(list 'calcFunc-sqrt
|
||||
(math-cancel-common-factor
|
||||
(math-cancel-common-factor
|
||||
(nth 1 math-simplify-expr) fac))))))
|
||||
(and math-living-dangerously
|
||||
(or (and (eq (car-safe (nth 1 math-simplify-expr)) '-)
|
||||
|
@ -1230,7 +1230,7 @@
|
|||
(and (eq (car-safe (nth 1 (nth 2 (nth 1 math-simplify-expr))))
|
||||
'calcFunc-cos)
|
||||
(list 'calcFunc-sin
|
||||
(nth 1 (nth 1 (nth 2
|
||||
(nth 1 (nth 1 (nth 2
|
||||
(nth 1 math-simplify-expr))))))))
|
||||
(and (eq (car-safe (nth 1 math-simplify-expr)) '-)
|
||||
(math-equal-int (nth 2 (nth 1 math-simplify-expr)) 1)
|
||||
|
@ -1370,7 +1370,7 @@
|
|||
(or (and (eq (car-safe (nth 1 math-simplify-expr)) '^)
|
||||
(list '^
|
||||
(nth 1 (nth 1 math-simplify-expr))
|
||||
(math-mul (nth 2 math-simplify-expr)
|
||||
(math-mul (nth 2 math-simplify-expr)
|
||||
(nth 2 (nth 1 math-simplify-expr)))))
|
||||
(and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-sqrt)
|
||||
(list '^
|
||||
|
@ -1378,9 +1378,9 @@
|
|||
(math-div (nth 2 math-simplify-expr) 2)))
|
||||
(and (memq (car-safe (nth 1 math-simplify-expr)) '(* /))
|
||||
(list (car (nth 1 math-simplify-expr))
|
||||
(list '^ (nth 1 (nth 1 math-simplify-expr))
|
||||
(list '^ (nth 1 (nth 1 math-simplify-expr))
|
||||
(nth 2 math-simplify-expr))
|
||||
(list '^ (nth 2 (nth 1 math-simplify-expr))
|
||||
(list '^ (nth 2 (nth 1 math-simplify-expr))
|
||||
(nth 2 math-simplify-expr))))))
|
||||
(and (math-equal-int (nth 1 math-simplify-expr) 10)
|
||||
(eq (car-safe (nth 2 math-simplify-expr)) 'calcFunc-log10)
|
||||
|
@ -1389,7 +1389,7 @@
|
|||
(math-simplify-exp (nth 2 math-simplify-expr)))
|
||||
(and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-exp)
|
||||
(not math-integrating)
|
||||
(list 'calcFunc-exp (math-mul (nth 1 (nth 1 math-simplify-expr))
|
||||
(list 'calcFunc-exp (math-mul (nth 1 (nth 1 math-simplify-expr))
|
||||
(nth 2 math-simplify-expr))))
|
||||
(and (equal (nth 1 math-simplify-expr) '(var i var-i))
|
||||
(math-imaginary-i)
|
||||
|
@ -1403,14 +1403,14 @@
|
|||
(integerp (nth 2 math-simplify-expr))
|
||||
(>= (nth 2 math-simplify-expr) 2)
|
||||
(or (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-cos)
|
||||
(math-mul (math-pow (nth 1 math-simplify-expr)
|
||||
(math-mul (math-pow (nth 1 math-simplify-expr)
|
||||
(- (nth 2 math-simplify-expr) 2))
|
||||
(math-sub 1
|
||||
(math-sqr
|
||||
(list 'calcFunc-sin
|
||||
(nth 1 (nth 1 math-simplify-expr)))))))
|
||||
(and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-cosh)
|
||||
(math-mul (math-pow (nth 1 math-simplify-expr)
|
||||
(math-mul (math-pow (nth 1 math-simplify-expr)
|
||||
(- (nth 2 math-simplify-expr) 2))
|
||||
(math-add 1
|
||||
(math-sqr
|
||||
|
@ -1443,14 +1443,14 @@
|
|||
(or (and (math-looks-negp (nth 1 math-simplify-expr))
|
||||
(math-neg (list 'calcFunc-erf (math-neg (nth 1 math-simplify-expr)))))
|
||||
(and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-conj)
|
||||
(list 'calcFunc-conj
|
||||
(list 'calcFunc-conj
|
||||
(list 'calcFunc-erf (nth 1 (nth 1 math-simplify-expr)))))))
|
||||
|
||||
(math-defsimplify calcFunc-erfc
|
||||
(or (and (math-looks-negp (nth 1 math-simplify-expr))
|
||||
(math-sub 2 (list 'calcFunc-erfc (math-neg (nth 1 math-simplify-expr)))))
|
||||
(and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-conj)
|
||||
(list 'calcFunc-conj
|
||||
(list 'calcFunc-conj
|
||||
(list 'calcFunc-erfc (nth 1 (nth 1 math-simplify-expr)))))))
|
||||
|
||||
|
||||
|
@ -1652,13 +1652,14 @@
|
|||
(car p))))
|
||||
|
||||
;;; If expr is of the form "a + bx + cx^2 + ...", return the list (a b c ...),
|
||||
;;; else return nil if not in polynomial form. If "loose" (math-is-poly-loose),
|
||||
;;; else return nil if not in polynomial form. If "loose" (math-is-poly-loose),
|
||||
;;; coefficients may contain x, e.g., sin(x) + cos(x) x^2 is a loose polynomial in x.
|
||||
|
||||
;; The variables math-is-poly-degree and math-is-poly-loose are local to
|
||||
;; math-is-polynomial, but are used by math-is-poly-rec
|
||||
;; These variables are local to math-is-polynomial, but are used by
|
||||
;; math-is-poly-rec.
|
||||
(defvar math-is-poly-degree)
|
||||
(defvar math-is-poly-loose)
|
||||
(defvar var)
|
||||
|
||||
(defun math-is-polynomial (expr var &optional math-is-poly-degree math-is-poly-loose)
|
||||
(let* ((math-poly-base-variable (if math-is-poly-loose
|
||||
|
@ -1744,7 +1745,7 @@
|
|||
(let ((p2 (math-is-poly-rec (nth 2 expr) negpow)))
|
||||
(and p2
|
||||
(or (null math-is-poly-degree)
|
||||
(<= (- (+ (length p1) (length p2)) 2)
|
||||
(<= (- (+ (length p1) (length p2)) 2)
|
||||
math-is-poly-degree))
|
||||
(math-poly-mul p1 p2))))))
|
||||
((eq (car expr) '/)
|
||||
|
|
|
@ -198,7 +198,7 @@
|
|||
(prefix-numeric-value nterms))))))
|
||||
|
||||
|
||||
;; The following are global variables used by math-derivative and some
|
||||
;; The following are global variables used by math-derivative and some
|
||||
;; related functions
|
||||
(defvar math-deriv-var)
|
||||
(defvar math-deriv-total)
|
||||
|
@ -416,7 +416,7 @@
|
|||
(list 'calcFunc-sec u)))))))
|
||||
|
||||
(put 'calcFunc-sec\' 'math-derivative-1
|
||||
(function (lambda (u) (math-to-radians-2
|
||||
(function (lambda (u) (math-to-radians-2
|
||||
(math-mul
|
||||
(math-normalize
|
||||
(list 'calcFunc-sec u))
|
||||
|
@ -424,7 +424,7 @@
|
|||
(list 'calcFunc-tan u)))))))
|
||||
|
||||
(put 'calcFunc-csc\' 'math-derivative-1
|
||||
(function (lambda (u) (math-neg
|
||||
(function (lambda (u) (math-neg
|
||||
(math-to-radians-2
|
||||
(math-mul
|
||||
(math-normalize
|
||||
|
@ -657,14 +657,14 @@
|
|||
;; which are called (directly or indirectly) by math-try-integral.
|
||||
(defvar math-integ-depth)
|
||||
;; math-integ-level is a local variable for math-try-integral, but is used
|
||||
;; by math-integral, math-do-integral, math-tracing-integral,
|
||||
;; math-sub-integration, math-integrate-by-parts and
|
||||
;; math-integrate-by-substitution, which are called (directly or
|
||||
;; by math-integral, math-do-integral, math-tracing-integral,
|
||||
;; math-sub-integration, math-integrate-by-parts and
|
||||
;; math-integrate-by-substitution, which are called (directly or
|
||||
;; indirectly) by math-try-integral.
|
||||
(defvar math-integ-level)
|
||||
;; math-integral-limit is a local variable for calcFunc-integ, but is
|
||||
;; used by math-tracing-integral, math-sub-integration and
|
||||
;; math-try-integration.
|
||||
;; used by math-tracing-integral, math-sub-integration and
|
||||
;; math-try-integration.
|
||||
(defvar math-integral-limit)
|
||||
|
||||
(defmacro math-tracing-integral (&rest parts)
|
||||
|
@ -828,11 +828,11 @@
|
|||
;; used by math-sub-integration.
|
||||
(defvar math-old-integ)
|
||||
|
||||
;; The variables math-t1, math-t2 and math-t3 are local to
|
||||
;; The variables math-t1, math-t2 and math-t3 are local to
|
||||
;; math-do-integral, math-try-solve-for and math-decompose-poly, but
|
||||
;; are used by functions they call (directly or indirectly);
|
||||
;; are used by functions they call (directly or indirectly);
|
||||
;; math-do-integral calls math-do-integral-methods;
|
||||
;; math-try-solve-for calls math-try-solve-prod,
|
||||
;; math-try-solve-for calls math-try-solve-prod,
|
||||
;; math-solve-find-root-term and math-solve-find-root-in-prod;
|
||||
;; math-decompose-poly calls math-solve-poly-funny-powers and
|
||||
;; math-solve-crunch-poly.
|
||||
|
@ -1075,12 +1075,12 @@
|
|||
(list 'calcFunc-integfailed expr)))
|
||||
|
||||
;; math-so-far is a local variable for math-do-integral-methods, but
|
||||
;; is used by math-integ-try-linear-substitutions and
|
||||
;; is used by math-integ-try-linear-substitutions and
|
||||
;; math-integ-try-substitutions.
|
||||
(defvar math-so-far)
|
||||
|
||||
;; math-integ-expr is a local variable for math-do-integral-methods,
|
||||
;; but is used by math-integ-try-linear-substitutions and
|
||||
;; but is used by math-integ-try-linear-substitutions and
|
||||
;; math-integ-try-substitutions.
|
||||
(defvar math-integ-expr)
|
||||
|
||||
|
@ -1253,8 +1253,8 @@
|
|||
temp (let (calc-next-why)
|
||||
(math-simplify-extended
|
||||
(math-solve-for (math-sub v temp) 0 v nil)))
|
||||
temp (if (and (eq (car-safe temp) '/)
|
||||
(math-zerop (nth 2 temp)))
|
||||
temp (if (and (eq (car-safe temp) '/)
|
||||
(math-zerop (nth 2 temp)))
|
||||
nil temp)))))
|
||||
(setcar (cdr math-cur-record) 'busy)))))
|
||||
|
||||
|
@ -1675,7 +1675,7 @@
|
|||
(math-defintegral calcFunc-sec
|
||||
(and (equal u math-integ-var)
|
||||
(math-from-radians-2
|
||||
(list 'calcFunc-ln
|
||||
(list 'calcFunc-ln
|
||||
(math-add
|
||||
(list 'calcFunc-sec u)
|
||||
(list 'calcFunc-tan u))))))
|
||||
|
@ -1683,7 +1683,7 @@
|
|||
(math-defintegral calcFunc-csc
|
||||
(and (equal u math-integ-var)
|
||||
(math-from-radians-2
|
||||
(list 'calcFunc-ln
|
||||
(list 'calcFunc-ln
|
||||
(math-sub
|
||||
(list 'calcFunc-csc u)
|
||||
(list 'calcFunc-cot u))))))
|
||||
|
@ -1882,13 +1882,14 @@
|
|||
(defvar math-tabulate-initial nil)
|
||||
(defvar math-tabulate-function nil)
|
||||
|
||||
;; The variables calc-low and calc-high are local to calcFunc-table,
|
||||
;; but are used by math-scan-for-limits.
|
||||
;; These variables are local to calcFunc-table, but are used by
|
||||
;; math-scan-for-limits.
|
||||
(defvar calc-low)
|
||||
(defvar calc-high)
|
||||
(defvar var)
|
||||
|
||||
(defun calcFunc-table (expr var &optional calc-low calc-high step)
|
||||
(or calc-low
|
||||
(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))
|
||||
(and (or (math-infinitep calc-low) (math-infinitep calc-high))
|
||||
|
@ -2348,23 +2349,23 @@
|
|||
|
||||
(defvar math-solve-ranges nil)
|
||||
(defvar math-solve-sign)
|
||||
;;; Attempt to reduce math-solve-lhs = math-solve-rhs to
|
||||
;;; Attempt to reduce math-solve-lhs = math-solve-rhs to
|
||||
;;; math-solve-var = math-solve-rhs', where math-solve-var appears
|
||||
;;; in math-solve-lhs but not in math-solve-rhs or math-solve-rhs';
|
||||
;;; in math-solve-lhs but not in math-solve-rhs or math-solve-rhs';
|
||||
;;; return math-solve-rhs'.
|
||||
;;; Uses global values: math-solve-var, math-solve-full.
|
||||
(defvar math-solve-var)
|
||||
(defvar math-solve-full)
|
||||
|
||||
;; The variables math-solve-lhs, math-solve-rhs and math-try-solve-sign
|
||||
;; are local to math-try-solve-for, but are used by math-try-solve-prod.
|
||||
;; (math-solve-lhs and math-solve-rhs are is also local to
|
||||
;; The variables math-solve-lhs, math-solve-rhs and math-try-solve-sign
|
||||
;; are local to math-try-solve-for, but are used by math-try-solve-prod.
|
||||
;; (math-solve-lhs and math-solve-rhs are is also local to
|
||||
;; math-decompose-poly, but used by math-solve-poly-funny-powers.)
|
||||
(defvar math-solve-lhs)
|
||||
(defvar math-solve-rhs)
|
||||
(defvar math-try-solve-sign)
|
||||
|
||||
(defun math-try-solve-for
|
||||
(defun math-try-solve-for
|
||||
(math-solve-lhs math-solve-rhs &optional math-try-solve-sign no-poly)
|
||||
(let (math-t1 math-t2 math-t3)
|
||||
(cond ((equal math-solve-lhs math-solve-var)
|
||||
|
@ -2395,7 +2396,7 @@
|
|||
(setq math-t2 (funcall math-t1 '(var SOLVEDUM SOLVEDUM)))
|
||||
(eq (math-expr-contains-count math-t2 '(var SOLVEDUM SOLVEDUM)) 1)
|
||||
(setq math-t3 (math-solve-above-dummy math-t2))
|
||||
(setq math-t1 (math-try-solve-for
|
||||
(setq math-t1 (math-try-solve-for
|
||||
(math-sub (nth 1 (nth 1 math-solve-lhs))
|
||||
(math-expr-subst
|
||||
math-t2 math-t3
|
||||
|
@ -2407,8 +2408,8 @@
|
|||
(and math-try-solve-sign (- math-try-solve-sign))))
|
||||
((and (not (eq math-solve-full 't)) (math-try-solve-prod)))
|
||||
((and (not no-poly)
|
||||
(setq math-t2
|
||||
(math-decompose-poly math-solve-lhs
|
||||
(setq math-t2
|
||||
(math-decompose-poly math-solve-lhs
|
||||
math-solve-var 15 math-solve-rhs)))
|
||||
(setq math-t1 (cdr (nth 1 math-t2))
|
||||
math-t1 (let ((math-solve-ranges math-solve-ranges))
|
||||
|
@ -2419,7 +2420,7 @@
|
|||
((= (length math-t1) 3)
|
||||
(apply 'math-solve-quadratic (car math-t2) math-t1))
|
||||
((= (length math-t1) 2)
|
||||
(apply 'math-solve-linear
|
||||
(apply 'math-solve-linear
|
||||
(car math-t2) math-try-solve-sign math-t1))
|
||||
(math-solve-full
|
||||
(math-poly-all-roots (car math-t2) math-t1))
|
||||
|
@ -2474,7 +2475,7 @@
|
|||
((not (math-expr-contains (nth 1 math-solve-lhs) math-solve-var))
|
||||
(math-try-solve-for (nth 2 math-solve-lhs)
|
||||
(math-sub (nth 1 math-solve-lhs) math-solve-rhs)
|
||||
(and math-try-solve-sign
|
||||
(and math-try-solve-sign
|
||||
(- math-try-solve-sign))))
|
||||
((not (math-expr-contains (nth 2 math-solve-lhs) math-solve-var))
|
||||
(math-try-solve-for (nth 1 math-solve-lhs)
|
||||
|
@ -2488,7 +2489,7 @@
|
|||
(nth 2 math-solve-lhs)))))
|
||||
((eq (car math-solve-lhs) 'calcFunc-log)
|
||||
(cond ((not (math-expr-contains (nth 2 math-solve-lhs) math-solve-var))
|
||||
(math-try-solve-for (nth 1 math-solve-lhs)
|
||||
(math-try-solve-for (nth 1 math-solve-lhs)
|
||||
(math-pow (nth 2 math-solve-lhs) math-solve-rhs)))
|
||||
((not (math-expr-contains (nth 1 math-solve-lhs) math-solve-var))
|
||||
(math-try-solve-for (nth 2 math-solve-lhs) (math-pow
|
||||
|
@ -2503,7 +2504,7 @@
|
|||
(and math-try-solve-sign math-t1
|
||||
(if (integerp math-t1)
|
||||
(* math-t1 math-try-solve-sign)
|
||||
(funcall math-t1 math-solve-lhs
|
||||
(funcall math-t1 math-solve-lhs
|
||||
math-try-solve-sign)))))
|
||||
((and (symbolp (car math-solve-lhs))
|
||||
(setq math-t1 (get (car math-solve-lhs) 'math-inverse-n))
|
||||
|
@ -2521,12 +2522,12 @@
|
|||
(cond ((not (math-expr-contains (nth 1 math-solve-lhs) math-solve-var))
|
||||
(math-try-solve-for (nth 2 math-solve-lhs)
|
||||
(math-div math-solve-rhs (nth 1 math-solve-lhs))
|
||||
(math-solve-sign math-try-solve-sign
|
||||
(math-solve-sign math-try-solve-sign
|
||||
(nth 1 math-solve-lhs))))
|
||||
((not (math-expr-contains (nth 2 math-solve-lhs) math-solve-var))
|
||||
(math-try-solve-for (nth 1 math-solve-lhs)
|
||||
(math-div math-solve-rhs (nth 2 math-solve-lhs))
|
||||
(math-solve-sign math-try-solve-sign
|
||||
(math-solve-sign math-try-solve-sign
|
||||
(nth 2 math-solve-lhs))))
|
||||
((Math-zerop math-solve-rhs)
|
||||
(math-solve-prod (let ((math-solve-ranges math-solve-ranges))
|
||||
|
@ -2536,12 +2537,12 @@
|
|||
(cond ((not (math-expr-contains (nth 1 math-solve-lhs) math-solve-var))
|
||||
(math-try-solve-for (nth 2 math-solve-lhs)
|
||||
(math-div (nth 1 math-solve-lhs) math-solve-rhs)
|
||||
(math-solve-sign math-try-solve-sign
|
||||
(math-solve-sign math-try-solve-sign
|
||||
(nth 1 math-solve-lhs))))
|
||||
((not (math-expr-contains (nth 2 math-solve-lhs) math-solve-var))
|
||||
(math-try-solve-for (nth 1 math-solve-lhs)
|
||||
(math-mul math-solve-rhs (nth 2 math-solve-lhs))
|
||||
(math-solve-sign math-try-solve-sign
|
||||
(math-solve-sign math-try-solve-sign
|
||||
(nth 2 math-solve-lhs))))
|
||||
((setq math-t1 (math-try-solve-for (math-sub (nth 1 math-solve-lhs)
|
||||
(math-mul (nth 2 math-solve-lhs)
|
||||
|
@ -2581,14 +2582,14 @@
|
|||
(math-normalize math-t2)))
|
||||
((math-looks-negp (nth 2 math-solve-lhs))
|
||||
(math-try-solve-for
|
||||
(list '^ (nth 1 math-solve-lhs)
|
||||
(list '^ (nth 1 math-solve-lhs)
|
||||
(math-neg (nth 2 math-solve-lhs)))
|
||||
(math-div 1 math-solve-rhs)))
|
||||
((and (eq math-solve-full t)
|
||||
(Math-integerp (nth 2 math-solve-lhs))
|
||||
(math-known-realp (nth 1 math-solve-lhs)))
|
||||
(setq math-t1 (math-normalize
|
||||
(list 'calcFunc-nroot math-solve-rhs
|
||||
(list 'calcFunc-nroot math-solve-rhs
|
||||
(nth 2 math-solve-lhs))))
|
||||
(if (math-evenp (nth 2 math-solve-lhs))
|
||||
(setq math-t1 (math-solve-get-sign math-t1)))
|
||||
|
@ -2596,7 +2597,7 @@
|
|||
(nth 1 math-solve-lhs) math-t1
|
||||
(and math-try-solve-sign
|
||||
(math-oddp (nth 2 math-solve-lhs))
|
||||
(math-solve-sign math-try-solve-sign
|
||||
(math-solve-sign math-try-solve-sign
|
||||
(nth 2 math-solve-lhs)))))
|
||||
(t (math-try-solve-for
|
||||
(nth 1 math-solve-lhs)
|
||||
|
@ -2628,7 +2629,7 @@
|
|||
(nth 2 math-solve-lhs))))
|
||||
(and math-try-solve-sign
|
||||
(math-oddp (nth 2 math-solve-lhs))
|
||||
(math-solve-sign math-try-solve-sign
|
||||
(math-solve-sign math-try-solve-sign
|
||||
(nth 2 math-solve-lhs)))))))))
|
||||
(t nil)))
|
||||
|
||||
|
@ -2665,7 +2666,7 @@
|
|||
(setq math-t2 (math-mul (or math-poly-mult-powers 1)
|
||||
(let ((calc-prefer-frac t))
|
||||
(math-div 1 math-poly-frac-powers)))
|
||||
math-t1 (math-is-polynomial
|
||||
math-t1 (math-is-polynomial
|
||||
(math-simplify (calcFunc-expand math-t1)) math-solve-b 50))))
|
||||
|
||||
;;; This converts "a x^8 + b x^5 + c x^2" to "(a (x^3)^2 + b (x^3) + c) * x^2".
|
||||
|
@ -2694,7 +2695,7 @@
|
|||
(setq math-t3 (cons scale (cdr math-t3))
|
||||
math-t1 new-t1))))
|
||||
(setq scale (1- scale)))
|
||||
(setq math-t3 (list (math-mul (car math-t3) math-t2)
|
||||
(setq math-t3 (list (math-mul (car math-t3) math-t2)
|
||||
(math-mul count math-t2)))
|
||||
(<= (1- (length math-t1)) max-degree)))))
|
||||
|
||||
|
@ -2733,7 +2734,7 @@
|
|||
(and (not (equal math-solve-b math-solve-lhs))
|
||||
(or (not (memq (car-safe math-solve-b) '(+ -))) sub-rhs)
|
||||
(setq math-t3 '(1 0) math-t2 1
|
||||
math-t1 (math-is-polynomial math-solve-lhs
|
||||
math-t1 (math-is-polynomial math-solve-lhs
|
||||
math-solve-b 50))
|
||||
(if (and (equal math-poly-neg-powers '(1))
|
||||
(memq math-poly-mult-powers '(nil 1))
|
||||
|
@ -3217,7 +3218,7 @@
|
|||
(and (not (math-expr-contains (nth 2 x) math-solve-var))
|
||||
(math-solve-find-root-in-prod (nth 1 x))))))))
|
||||
|
||||
;; The variable math-solve-vars is local to math-solve-system,
|
||||
;; The variable math-solve-vars is local to math-solve-system,
|
||||
;; but is used by math-solve-system-rec.
|
||||
(defvar math-solve-vars)
|
||||
|
||||
|
@ -3282,7 +3283,7 @@
|
|||
(while (and e2
|
||||
(setq res2 (or (and (eq (car e2) eprev)
|
||||
res2)
|
||||
(math-solve-for (car e2) 0
|
||||
(math-solve-for (car e2) 0
|
||||
math-solve-system-vv
|
||||
math-solve-full))))
|
||||
(setq eprev (car e2)
|
||||
|
@ -3313,8 +3314,8 @@
|
|||
solns)))
|
||||
(if elim
|
||||
s
|
||||
(cons (cons
|
||||
math-solve-system-vv
|
||||
(cons (cons
|
||||
math-solve-system-vv
|
||||
(apply 'append math-solve-system-res))
|
||||
s)))))
|
||||
(not math-solve-system-res))))
|
||||
|
@ -3350,9 +3351,9 @@
|
|||
(lambda (r)
|
||||
(if math-solve-simplifying
|
||||
(math-simplify
|
||||
(math-expr-subst
|
||||
(math-expr-subst
|
||||
(car x) math-solve-system-vv r))
|
||||
(math-expr-subst
|
||||
(math-expr-subst
|
||||
(car x) math-solve-system-vv r))))
|
||||
(car res2)))
|
||||
x (cdr x)
|
||||
|
|
Loading…
Add table
Reference in a new issue