(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
(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)
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)
(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)
(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)))
(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))
(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)) '/)
(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))))
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)
(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))
(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)))
(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)))))
(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))
(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))
(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
(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))))))
(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
(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
(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
(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
(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))))
(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)) '-)
(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)
(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 '^
(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)
(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)
(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
(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)))))))
(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
(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) '/)
(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)
(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))
(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
;; 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)
;; 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.
(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)
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)))))
(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))))))
(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))))))
(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))
(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)
(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
(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))
((= (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))
((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)
(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
(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))
(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))
(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)
(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)))
(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)
(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)))
(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".
(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)))))
(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))
(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)
(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)
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))))
(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)