X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/6664fc59a8f296117ea98b943f062c0cc0e907c1..d14365f9411ab4b20db6c455aa9cf24ce6a0bcb1:/lisp/calc/calc-poly.el diff --git a/lisp/calc/calc-poly.el b/lisp/calc/calc-poly.el index f268a032d1..07d725c88e 100644 --- a/lisp/calc/calc-poly.el +++ b/lisp/calc/calc-poly.el @@ -1,7 +1,6 @@ ;;; calc-poly.el --- polynomial functions for Calc -;; Copyright (C) 1990, 1991, 1992, 1993, 2001, 2002, 2003, 2004, -;; 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 1990-1993, 2001-2013 Free Software Foundation, Inc. ;; Author: David Gillespie ;; Maintainer: Jay Belanger @@ -148,7 +147,7 @@ ;;; Return only quotient to top of stack (nil if zero) -;; calc-poly-div-remainder is a local variable for +;; calc-poly-div-remainder is a local variable for ;; calc-poly-div (in calc-alg.el), but is used by ;; calcFunc-pdiv, which is called by calc-poly-div. (defvar calc-poly-div-remainder) @@ -420,7 +419,7 @@ (list 'frac 1 denom)) 1)) -;;; Compute the GCD of two monovariate polynomial lists. +;;; Compute the GCD of two univariate polynomial lists. ;;; Knuth section 4.6.1, algorithm C. (defun math-poly-gcd-coefs (u v) (let ((d (math-poly-gcd (math-poly-gcd-list u) @@ -513,7 +512,7 @@ ;;; Given an expression find all variables that are polynomial bases. ;;; Return list in the form '( (var1 degree1) (var2 degree2) ... ). -;; The variable math-poly-base-total-base is local to +;; The variable math-poly-base-total-base is local to ;; math-total-polynomial-base, but is used by math-polynomial-p1, ;; which is called by math-total-polynomial-base. (defvar math-poly-base-total-base) @@ -540,19 +539,19 @@ nil) ;; The variable math-factored-vars is local to calcFunc-factors and -;; calcFunc-factor, but is used by math-factor-expr and +;; calcFunc-factor, but is used by math-factor-expr and ;; math-factor-expr-part, which are called (directly and indirectly) by ;; calcFunc-factor and calcFunc-factors. (defvar math-factored-vars) ;; The variable math-fact-expr is local to calcFunc-factors, -;; calcFunc-factor and math-factor-expr, but is used by math-factor-expr-try +;; calcFunc-factor and math-factor-expr, but is used by math-factor-expr-try ;; and math-factor-expr-part, which are called (directly and indirectly) by ;; calcFunc-factor, calcFunc-factors and math-factor-expr. (defvar math-fact-expr) -;; The variable math-to-list is local to calcFunc-factors and -;; calcFunc-factor, but is used by math-accum-factors, which is +;; The variable math-to-list is local to calcFunc-factors and +;; calcFunc-factor, but is used by math-accum-factors, which is ;; called (indirectly) by calcFunc-factors and calcFunc-factor. (defvar math-to-list) @@ -730,7 +729,7 @@ '(1))) ;; We now have a square-free polynomial with integer coefs. - ;; For now, we use a kludgey method that finds linear and + ;; For now, we use a kludgy method that finds linear and ;; quadratic terms using floating-point root-finding. (if (setq t1 (let ((calc-symbolic-mode nil)) (math-poly-all-roots nil p t))) @@ -750,7 +749,7 @@ (math-add (math-add (math-mul den (math-pow math-fet-x 2)) - (math-mul (math-mul coef1 den) + (math-mul (math-mul coef1 den) math-fet-x)) (math-mul coef0 den))) (let ((den (math-lcm-denoms coef0))) @@ -1078,7 +1077,7 @@ If no partial fraction representation can be found, return nil." ((and (eq (car-safe expr) '^) (memq (car-safe (nth 1 expr)) '(+ -)) (integerp (nth 2 expr)) - (if (and + (if (and (or (math-known-matrixp (nth 1 (nth 1 expr))) (math-known-matrixp (nth 2 (nth 1 expr))) (and @@ -1091,11 +1090,11 @@ If no partial fraction representation can be found, return nil." (math-add-or-sub (list '* (nth 1 (nth 1 expr)) (nth 1 expr)) (list '* (nth 2 (nth 1 expr)) (nth 1 expr)) nil (eq (car (nth 1 expr)) '-)) - (math-add-or-sub (list '* (nth 1 (nth 1 expr)) - (list '^ (nth 1 expr) + (math-add-or-sub (list '* (nth 1 (nth 1 expr)) + (list '^ (nth 1 expr) (1- (nth 2 expr)))) - (list '* (nth 2 (nth 1 expr)) - (list '^ (nth 1 expr) + (list '* (nth 2 (nth 1 expr)) + (list '^ (nth 1 expr) (1- (nth 2 expr)))) nil (eq (car (nth 1 expr)) '-))) (if (> (nth 2 expr) 0) @@ -1200,5 +1199,4 @@ If no partial fraction representation can be found, return nil." (provide 'calc-poly) -;; arch-tag: d2566c51-2ccc-45f1-8c50-f3462c2953ff ;;; calc-poly.el ends here