• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10.1/emacs-93/emacs/lisp/calc/

Lines Matching +defs:math +defs:to +defs:ratpoly

22 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
38 ((Math-messy-integerp expr) (math-trunc expr))
43 (math-mul (calcFunc-pcont (nth 1 expr) var)
46 (math-div (calcFunc-pcont (nth 1 expr) var)
49 (math-pow (calcFunc-pcont (nth 1 expr) var) (nth 2 expr)))
53 (let ((p (math-is-polynomial expr var)))
56 (cont (math-poly-gcd-list p)))
57 (if (math-guess-if-neg lead)
58 (math-neg cont)
66 (if (and (math-negp cont)
67 (if (eq (car expr) '-) (math-posp c2) (math-negp c2)))
68 (math-neg (math-poly-gcd cont c2))
69 (math-poly-gcd cont c2))))))
75 (if (math-equal-int cont 1)
77 (math-poly-div-exact expr cont var))))
79 (defun math-div-poly-const (expr c)
82 (math-div-poly-const (nth 1 expr) c)
83 (math-div-poly-const (nth 2 expr) c)))
84 (t (math-div expr c))))
90 (or (math-polynomial-p expr var)
91 (math-reject-arg expr "Expected a polynomial"))
92 (math-poly-degree expr))))
94 (defun math-poly-degree (expr)
98 (math-poly-degree (nth 1 expr)))
100 (+ (math-poly-degree (nth 1 expr))
101 (math-poly-degree (nth 2 expr))))
103 (- (math-poly-degree (nth 1 expr))
104 (math-poly-degree (nth 2 expr))))
106 (* (math-poly-degree (nth 1 expr)) (nth 2 expr)))
108 (max (math-poly-degree (nth 1 expr))
109 (math-poly-degree (nth 2 expr))))
114 (math-mul (calcFunc-plead (nth 1 expr) var)
117 (math-div (calcFunc-plead (nth 1 expr) var)
119 ((and (eq (car-safe expr) '^) (math-natnump (nth 2 expr)))
120 (math-pow (calcFunc-plead (nth 1 expr) var) (nth 2 expr)))
126 (let ((p (math-is-polynomial expr var)))
139 (defvar math-poly-modulus 1)
143 (if (math-any-floats pn)
144 (math-reject-arg pn "Coefficients must be rational"))
145 (if (math-any-floats pd)
146 (math-reject-arg pd "Coefficients must be rational"))
148 (math-poly-modulus (math-poly-modulus pn pd)))
149 (math-poly-gcd pn pd)))
151 ;;; Return only quotient to top of stack (nil if zero)
160 (math-poly-modulus (math-poly-modulus pn pd))
161 (res (math-poly-div pn pd base)))
165 ;;; Return only remainder to top of stack
168 (math-poly-modulus (math-poly-modulus pn pd)))
169 (cdr (math-poly-div pn pd base))))
173 (math-poly-modulus (math-poly-modulus pn pd))
174 (res (math-poly-div pn pd base)))
179 (math-poly-modulus (math-poly-modulus pn pd))
180 (res (math-poly-div pn pd base)))
181 (math-add (car res) (math-div (cdr res) pd))))
185 (defun math-mul-thru (lhs rhs)
188 (math-mul-thru (nth 1 lhs) rhs)
189 (math-mul-thru (nth 2 lhs) rhs))
192 (math-mul-thru lhs (nth 1 rhs))
193 (math-mul-thru lhs (nth 2 rhs)))
194 (math-mul lhs rhs))))
196 (defun math-div-thru (num den)
199 (math-div-thru (nth 1 num) den)
200 (math-div-thru (nth 2 num) den))
201 (math-div num den)))
205 (defun math-sort-terms (expr)
207 (math-list-to-sum
208 (sort (math-sum-to-list expr)
209 (function (lambda (a b) (math-beforep (car a) (car b))))))
212 (defun math-list-to-sum (lst)
215 (math-list-to-sum (cdr lst))
218 (math-neg (car (car lst)))
221 (defun math-sum-to-list (tree &optional neg)
223 (nconc (math-sum-to-list (nth 1 tree) neg)
224 (math-sum-to-list (nth 2 tree) neg)))
226 (nconc (math-sum-to-list (nth 1 tree) neg)
227 (math-sum-to-list (nth 2 tree) (not neg))))
231 (defun math-poly-modulus (expr &optional expr2)
232 (or (math-poly-modulus-rec expr)
233 (and expr2 (math-poly-modulus-rec expr2))
236 (defun math-poly-modulus-rec (expr)
240 (or (math-poly-modulus-rec (nth 1 expr))
241 (math-poly-modulus-rec (nth 2 expr))))))
245 (defvar math-poly-div-base nil)
246 (defun math-poly-div (u v &optional math-poly-div-base)
247 (if math-poly-div-base
248 (math-do-poly-div u v)
249 (math-do-poly-div (calcFunc-expand u) (calcFunc-expand v))))
251 (defun math-poly-div-exact (u v &optional base)
252 (let ((res (math-poly-div u v base)))
255 (math-reject-arg (list 'vec u v) "Argument is not a polynomial"))))
257 (defun math-do-poly-div (u v)
258 (cond ((math-constp u)
259 (if (math-constp v)
260 (cons (math-div u v) 0)
262 ((math-constp v)
266 (math-add-or-sub (math-poly-div-exact (nth 1 u) v)
267 (math-poly-div-exact (nth 2 u) v)
269 (math-div u v)))
272 (cons math-poly-modulus 0))
273 ((and (math-atomic-factorp u) (math-atomic-factorp v))
274 (cons (math-simplify (math-div u v)) 0))
276 (let ((base (or math-poly-div-base
277 (math-poly-div-base u v)))
280 (null (setq vp (math-is-polynomial v base nil 'gen))))
282 (setq up (math-is-polynomial u base nil 'gen)
283 res (math-poly-div-coefs up vp))
284 (cons (math-build-polynomial-expr (car res) base)
285 (math-build-polynomial-expr (cdr res) base)))))))
287 (defun math-poly-div-rec (u v)
288 (cond ((math-constp u)
289 (math-div u v))
290 ((math-constp v)
294 (math-add-or-sub (math-poly-div-rec (nth 1 u) v)
295 (math-poly-div-rec (nth 2 u) v)
297 (math-div u v))))
298 ((Math-equal u v) math-poly-modulus)
299 ((and (math-atomic-factorp u) (math-atomic-factorp v))
300 (math-simplify (math-div u v)))
301 (math-poly-div-base
302 (math-div u v))
304 (let ((base (math-poly-div-base u v))
307 (null (setq vp (math-is-polynomial v base nil 'gen))))
308 (math-div u v)
309 (setq up (math-is-polynomial u base nil 'gen)
310 res (math-poly-div-coefs up vp))
311 (math-add (math-build-polynomial-expr (car res) base)
312 (math-div (math-build-polynomial-expr (cdr res) base)
316 (defun math-poly-div-coefs (u v)
317 (cond ((null v) (math-reject-arg nil "Division by zero"))
324 (let ((qk (math-poly-div-rec (math-simplify (car urev))
328 (if (or q (not (math-zerop qk)))
331 (setcar up (math-sub (car up) (math-mul-thru qk (car vp)))))
336 (cons q (nreverse (mapcar 'math-simplify urev)))))
338 (cons (list (math-poly-div-rec (car u) (car v)))
343 (defun math-poly-pseudo-div (u v)
354 (setcar up (math-sub (math-mul-thru (car vrev) (car up))
355 (math-mul-thru (car urev) (car vp)))))
359 (setcar up (math-mul-thru (car vrev) (car up)))
363 (nreverse (mapcar 'math-simplify urev))))
367 (defun math-poly-gcd (u v)
369 ((math-constp u)
373 ((math-constp v)
378 (let ((base (math-poly-gcd-base u v)))
380 (math-simplify
382 (math-build-polynomial-expr
383 (math-poly-gcd-coefs (math-is-polynomial u base nil 'gen)
384 (math-is-polynomial v base nil 'gen))
388 (defun math-poly-div-list (lst a)
392 (math-mul-list lst a)
393 (mapcar (function (lambda (x) (math-poly-div-exact x a))) lst))))
395 (defun math-mul-list (lst a)
399 (mapcar 'math-neg lst)
401 (mapcar (function (lambda (x) (math-mul x a))) lst)))))
404 (defun math-poly-gcd-list (lst)
406 (math-poly-gcd-frac-list lst)
410 (setq gcd (math-poly-gcd gcd (car lst)))))
411 (if lst (setq lst (math-poly-gcd-frac-list lst)))
414 (defun math-poly-gcd-frac-list (lst)
427 (defun math-poly-gcd-coefs (u v)
428 (let ((d (math-poly-gcd (math-poly-gcd-list u)
429 (math-poly-gcd-list v)))
434 (setq u (math-poly-div-list u d)
435 v (math-poly-div-list v d)))
440 (setq r (math-poly-pseudo-div u v))
443 v (math-poly-div-list r (math-mul g (math-pow h delta)))
446 (math-mul (math-pow g delta) (math-pow h (- 1 delta)))
447 (math-poly-div-exact (math-pow g delta)
448 (math-pow h (1- delta))))))
451 (math-mul-list (math-poly-div-list v (math-poly-gcd-list v)) d)))
452 (if (math-guess-if-neg (nth (1- (length v)) v))
453 (setq v (math-mul-list v -1)))
460 (defun math-atomic-factorp (expr)
462 (and (math-atomic-factorp (nth 1 expr))
463 (math-atomic-factorp (nth 2 expr))))
467 (math-atomic-factorp (nth 1 expr)))
477 (defun math-poly-div-base (a b)
479 (and (setq a-base (math-total-polynomial-base a))
480 (setq b-base (math-total-polynomial-base b))
494 (defun math-poly-gcd-base (a b)
496 (and (setq a-base (math-total-polynomial-base a))
497 (setq b-base (math-total-polynomial-base b))
509 (defun math-sort-poly-base-list (lst)
513 (math-beforep (car a) (car b))))))))
518 ;; The variable math-poly-base-total-base is local to
519 ;; math-total-polynomial-base, but is used by math-polynomial-p1,
520 ;; which is called by math-total-polynomial-base.
521 (defvar math-poly-base-total-base)
523 (defun math-total-polynomial-base (expr)
524 (let ((math-poly-base-total-base nil))
525 (math-polynomial-base expr 'math-polynomial-p1)
526 (math-sort-poly-base-list math-poly-base-total-base)))
528 ;; The variable math-poly-base-top-expr is local to math-polynomial-base
529 ;; in calc-alg.el, but is used by math-polynomial-p1 which is called
530 ;; by math-polynomial-base.
531 (defvar math-poly-base-top-expr)
533 (defun math-polynomial-p1 (subexpr)
534 (or (assoc subexpr math-poly-base-total-base)
537 (let* ((math-poly-base-variable subexpr)
538 (exponent (math-polynomial-p math-poly-base-top-expr subexpr)))
540 (setq math-poly-base-total-base (cons (list subexpr exponent)
541 math-poly-base-total-base)))))
544 ;; The variable math-factored-vars is local to calcFunc-factors and
545 ;; calcFunc-factor, but is used by math-factor-expr and
546 ;; math-factor-expr-part, which are called (directly and indirectly) by
548 (defvar math-factored-vars)
550 ;; The variable math-fact-expr is local to calcFunc-factors,
551 ;; calcFunc-factor and math-factor-expr, but is used by math-factor-expr-try
552 ;; and math-factor-expr-part, which are called (directly and indirectly) by
553 ;; calcFunc-factor, calcFunc-factors and math-factor-expr.
554 (defvar math-fact-expr)
556 ;; The variable math-to-list is local to calcFunc-factors and
557 ;; calcFunc-factor, but is used by math-accum-factors, which is
559 (defvar math-to-list)
561 (defun calcFunc-factors (math-fact-expr &optional var)
562 (let ((math-factored-vars (if var t nil))
563 (math-to-list t)
566 (setq var (math-polynomial-base math-fact-expr)))
567 (let ((res (math-factor-finish
568 (or (catch 'factor (math-factor-expr-try var))
569 math-fact-expr))))
570 (math-simplify (if (math-vectorp res)
574 (defun calcFunc-factor (math-fact-expr &optional var)
575 (let ((math-factored-vars nil)
576 (math-to-list nil)
578 (math-simplify (math-factor-finish
580 (let ((math-factored-vars t))
581 (or (catch 'factor (math-factor-expr-try var)) math-fact-expr))
582 (math-factor-expr math-fact-expr))))))
584 (defun math-factor-finish (x)
588 (math-factor-finish (nth 1 x))
589 (cons (car x) (mapcar 'math-factor-finish (cdr x))))))
591 (defun math-factor-protect (x)
596 (defun math-factor-expr (math-fact-expr)
597 (cond ((eq math-factored-vars t) math-fact-expr)
598 ((or (memq (car-safe math-fact-expr) '(* / ^ neg))
599 (assq (car-safe math-fact-expr) calc-tweak-eqn-table))
600 (cons (car math-fact-expr) (mapcar 'math-factor-expr (cdr math-fact-expr))))
601 ((memq (car-safe math-fact-expr) '(+ -))
602 (let* ((math-factored-vars math-factored-vars)
603 (y (catch 'factor (math-factor-expr-part math-fact-expr))))
605 (math-factor-expr y)
606 math-fact-expr)))
607 (t math-fact-expr)))
609 (defun math-factor-expr-part (x) ; uses "expr"
612 (math-factor-expr-part (car x)))
614 (not (assoc x math-factored-vars))
615 (> (math-factor-contains math-fact-expr x) 1)
616 (setq math-factored-vars (cons (list x) math-factored-vars))
617 (math-factor-expr-try x))))
619 ;; The variable math-fet-x is local to math-factor-expr-try, but is
620 ;; used by math-factor-poly-coefs, which is called by math-factor-expr-try.
621 (defvar math-fet-x)
623 (defun math-factor-expr-try (math-fet-x)
624 (if (eq (car-safe math-fact-expr) '*)
625 (let ((res1 (catch 'factor (let ((math-fact-expr (nth 1 math-fact-expr)))
626 (math-factor-expr-try math-fet-x))))
627 (res2 (catch 'factor (let ((math-fact-expr (nth 2 math-fact-expr)))
628 (math-factor-expr-try math-fet-x)))))
630 (throw 'factor (math-accum-factors (or res1 (nth 1 math-fact-expr)) 1
631 (or res2 (nth 2 math-fact-expr))))))
632 (let* ((p (math-is-polynomial math-fact-expr math-fet-x 30 'gen))
633 (math-poly-modulus (math-poly-modulus math-fact-expr))
636 (setq res (math-factor-poly-coefs p))
639 (defun math-accum-factors (fac pow facs)
640 (if math-to-list
641 (if (math-vectorp fac)
644 (setq facs (math-accum-factors (nth 1 (car fac))
653 (or (math-vectorp facs)
668 (math-mul (math-pow fac pow) facs)))
670 (defun math-factor-poly-coefs (p &optional square-free) ; uses "x"
675 ;; Strip off multiples of math-fet-x.
681 (setq p (math-factor-poly-coefs p square-free))
682 (setq p (math-sort-terms (math-factor-expr (car p)))))
683 (math-accum-factors math-fet-x z (math-factor-protect p))))
687 (not (eq 1 (setq t1 (math-mul (math-poly-gcd-list p)
688 (if (math-guess-if-neg
691 (math-accum-factors t1 1 (math-factor-poly-coefs
692 (math-poly-div-list p t1) 'cont)))
694 ;; Check if linear in math-fet-x.
696 (math-sort-terms
697 (math-add (math-factor-protect
698 (math-sort-terms
699 (math-factor-expr (car p))))
700 (math-mul math-fet-x (math-factor-protect
701 (math-sort-terms
702 (math-factor-expr (nth 1 p))))))))
712 (let ((res (math-rewrite
713 (list 'calcFunc-thecoefs math-fet-x (cons 'vec p))
717 (math-vectorp (nth 2 res))
721 (setq facs (math-accum-factors (car vec) 1 facs)))
723 (math-build-polynomial-expr p math-fet-x))))
726 ((eq math-poly-modulus 1)
730 (equal (setq t1 (math-poly-gcd-coefs
731 p (setq t2 (math-poly-deriv-coefs p))))
738 (math-poly-all-roots nil p t)))
740 (csign (if (math-negp (nth (1- (length p)) p)) -1 1))
747 (setq expr (math-accum-factors
749 (let ((den (math-lcm-denoms
751 (setq scale (math-div scale den))
752 (math-add
753 (math-add
754 (math-mul den (math-pow math-fet-x 2))
755 (math-mul (math-mul coef1 den)
756 math-fet-x))
757 (math-mul coef0 den)))
758 (let ((den (math-lcm-denoms coef0)))
759 (setq scale (math-div scale den))
760 (math-add (math-mul den math-fet-x)
761 (math-mul coef0 den))))
764 (setq expr (math-accum-factors
766 (math-mul csign
767 (math-build-polynomial-expr
768 (math-mul-list (nth 1 t1) scale)
769 math-fet-x)))))
770 (math-build-polynomial-expr p math-fet-x)) ; can't factor it.
774 (let* ((cabs (math-poly-gcd-list p))
775 (csign (if (math-negp (nth (1- (length p)) p)) -1 1))
776 (t1s (math-mul-list t1 csign))
778 (v (car (math-poly-div-coefs p t1s)))
779 (w (car (math-poly-div-coefs t2 t1s))))
781 (not (math-poly-zerop
782 (setq t2 (math-poly-simplify
783 (math-poly-mix
784 w 1 (math-poly-deriv-coefs v) -1)))))
785 (setq t1 (math-poly-gcd-coefs v t2)
787 v (car (math-poly-div-coefs v t1))
788 w (car (math-poly-div-coefs t2 t1))))
790 t2 (math-accum-factors (math-factor-poly-coefs v t)
793 (setq t2 (math-accum-factors (math-factor-poly-coefs
798 (math-accum-factors (math-mul cabs csign) 1 t2))))
801 ((and (= (length (setq temp (math-poly-gcd-coefs
802 p (math-poly-deriv-coefs p))))
806 (setq temp (nthcdr (nth 2 math-poly-modulus) temp)
808 (and (setq temp (math-factor-poly-coefs p))
809 (math-pow temp (nth 2 math-poly-modulus))))
811 (math-reject-arg nil "*Modulo factorization not yet implemented")))))
813 (defun math-poly-deriv-coefs (p)
817 (setq dp (cons (math-mul (car p) n) dp)
821 (defun math-factor-contains (x a)
827 (setq sum (+ sum (math-factor-contains (car x) a))))
831 (* (math-factor-contains (nth 1 x) a) (nth 2 x))
840 (if (math-any-floats expr)
842 (if (or (math-vectorp expr)
846 (res (math-to-ratpoly expr))
847 (num (math-simplify (math-sort-terms (calcFunc-expand (car res)))))
848 (den (math-simplify (math-sort-terms (calcFunc-expand (cdr res)))))
849 (g (math-poly-gcd num den)))
851 (let ((num2 (math-poly-div num g))
852 (den2 (math-poly-div den g)))
855 (math-simplify (math-div num den)))))
858 (defun math-to-ratpoly (expr)
859 (let ((res (math-to-ratpoly-rec expr)))
860 (cons (math-simplify (car res)) (math-simplify (cdr res)))))
862 (defun math-to-ratpoly-rec (expr)
866 (let ((r1 (math-to-ratpoly-rec (nth 1 expr)))
867 (r2 (math-to-ratpoly-rec (nth 2 expr))))
872 (math-mul (car r1) (cdr r2))
878 (math-mul (car r2) (cdr r1)))
880 (let ((g (math-poly-gcd (cdr r1) (cdr r2))))
881 (let ((d1 (and (not (eq g 1)) (math-poly-div (cdr r1) g)))
882 (d2 (and (not (eq g 1)) (math-poly-div
883 (math-mul (car r1) (cdr r2))
887 (math-mul (car r2) (car d1)))
888 (math-mul (car d1) (cdr r2)))
890 (math-mul (car r1) (cdr r2))
891 (math-mul (car r2) (cdr r1)))
892 (math-mul (cdr r1) (cdr r2)))))))))))
894 (let* ((r1 (math-to-ratpoly-rec (nth 1 expr)))
895 (r2 (math-to-ratpoly-rec (nth 2 expr)))
896 (g (math-mul (math-poly-gcd (car r1) (cdr r2))
897 (math-poly-gcd (cdr r1) (car r2)))))
899 (cons (math-mul (car r1) (car r2))
900 (math-mul (cdr r1) (cdr r2)))
901 (cons (math-poly-div-exact (math-mul (car r1) (car r2)) g)
902 (math-poly-div-exact (math-mul (cdr r1) (cdr r2)) g)))))
904 (let* ((r1 (math-to-ratpoly-rec (nth 1 expr)))
905 (r2 (math-to-ratpoly-rec (nth 2 expr))))
908 (let ((g (math-mul (math-poly-gcd (car r1) (car r2))
909 (math-poly-gcd (cdr r1) (cdr r2)))))
911 (cons (math-mul (car r1) (cdr r2))
912 (math-mul (cdr r1) (car r2)))
913 (cons (math-poly-div-exact (math-mul (car r1) (cdr r2)) g)
914 (math-poly-div-exact (math-mul (cdr r1) (car r2))
917 (let ((r1 (math-to-ratpoly-rec (nth 1 expr))))
919 (cons (math-pow (car r1) (nth 2 expr))
920 (math-pow (cdr r1) (nth 2 expr)))
921 (cons (math-pow (cdr r1) (- (nth 2 expr)))
922 (math-pow (car r1) (- (nth 2 expr)))))))
924 (let ((r1 (math-to-ratpoly-rec (nth 1 expr))))
925 (cons (math-neg (car r1)) (cdr r1))))
929 (defun math-ratpoly-p (expr &optional var)
933 (let ((p1 (math-ratpoly-p (nth 1 expr) var))
935 (and p1 (setq p2 (math-ratpoly-p (nth 2 expr) var))
938 (let ((p1 (math-ratpoly-p (nth 1 expr) var))
940 (and p1 (setq p2 (math-ratpoly-p (nth 2 expr) var))
943 (math-ratpoly-p (nth 1 expr) var))
945 (let ((p1 (math-ratpoly-p (nth 1 expr) var))
947 (and p1 (setq p2 (math-ratpoly-p (nth 2 expr) var))
951 (let ((p1 (math-ratpoly-p (nth 1 expr) var)))
954 ((math-poly-depends expr var) nil)
961 (math-add (calcFunc-apart (nth 1 expr) var)
964 (math-sub (calcFunc-apart (nth 1 expr) var)
966 ((not (math-ratpoly-p expr var))
967 (math-reject-arg expr "Expected a rational function"))
970 (rat (math-to-ratpoly expr))
973 (qr (math-poly-div num den))
977 (setq var (math-polynomial-base den)))
978 (math-add q (or (and var
979 (math-expr-contains den var)
980 (math-partial-fractions r den var))
981 (math-div r den)))))))
984 (defun math-padded-polynomial (expr var deg)
985 (let ((p (math-is-polynomial expr var deg)))
988 (defun math-partial-fractions (r den var)
990 (tdeg (math-polynomial-p den var))
1001 (deg (math-polynomial-p (nth 1 (car fp)) var))
1011 dnum (math-add dnum (math-mul dvar
1012 (math-pow var deg2)))
1014 (math-pow (nth 1 (car fp)) rpt))
1020 (setq mult (math-mul mult
1021 (math-pow (nth 1 (car fpp))
1023 (setq dnum (math-mul dnum mult)))
1024 (setq eqns (math-add eqns (math-mul dnum
1025 (math-pow
1030 (setq eqns (math-div (cons 'vec (math-padded-polynomial r var tdeg))
1031 (math-transpose
1036 (cons 'vec (math-padded-polynomial
1039 (and (math-vectorp eqns)
1047 (setq num (math-build-polynomial-expr
1049 res (math-add res (math-div num (car dlist)))
1052 (math-normalize res)))))))
1056 (defun math-expand-term (expr)
1059 (math-add-or-sub (list '* (nth 1 (nth 1 expr)) (nth 2 expr))
1064 (math-add-or-sub (list '* (nth 1 expr) (nth 1 (nth 2 expr)))
1069 (math-add-or-sub (list '/ (nth 1 (nth 1 expr)) (nth 2 expr))
1076 (or (math-known-matrixp (nth 1 (nth 1 expr)))
1077 (math-known-matrixp (nth 2 (nth 1 expr)))
1081 (not (and (math-known-scalarp (nth 1 (nth 1 expr)))
1082 (math-known-scalarp (nth 2 (nth 1 expr)))))))
1085 (math-add-or-sub (list '* (nth 1 (nth 1 expr)) (nth 1 expr))
1088 (math-add-or-sub (list '* (nth 1 (nth 1 expr))
1096 (or (and (or (> math-mt-many 500000) (< math-mt-many -500000))
1097 (math-expand-power (nth 1 expr) (nth 2 expr)
1107 (math-normalize (math-map-tree 'math-expand-term expr many)))
1109 (defun math-expand-power (x n &optional var else-nil)
1116 (math-neg (nth 2 x))
1124 (or (math-expr-contains (car p) var)
1193 (math-normalize (math-expand-power x n)))