[Maxima-commits] [git] Maxima CAS branch, master, updated. branch-5_31-base-204-g29fe517



I haven't been following your changes very closely, but I was wondering why
the seemingly gratuitous renaming of PTERM to PTTERM?  Does PTTERM make
more sense in some way?

Also, I know it's hard, but is it possible to separate the documentation
phase from the changes phase?  Some of your commits say you're adding
documentation, but then lots of code is changed.  Perhaps only indentation
changed, but still, someone might look at it and wonder. :-)



On Sat, Dec 7, 2013 at 8:54 AM, Rupert Swarbrick <
rswarbrick at users.sourceforge.net> wrote:

> This is an automated email from the git hooks/post-receive script. It was
> generated because a ref change was pushed to the repository containing
> the project "Maxima CAS".
>
> The branch, master has been updated
>        via  29fe517aad136c878d4e6b33e661b5dbf6460fc9 (commit)
>        via  fa3fff42abdbb571bb96db139e1a34c7d7c890c7 (commit)
>       from  69f254a035d4e92d574c307f0ed34c389d2bc3c4 (commit)
>
> Those revisions listed above that are new to this repository have
> not appeared on any other notification email; so we list those
> revisions in full, below.
>
> - Log -----------------------------------------------------------------
> commit 29fe517aad136c878d4e6b33e661b5dbf6460fc9
> Author: Rupert Swarbrick <rswarbrick at gmail.com>
> Date:   Sat Dec 7 16:22:35 2013 +0000
>
>     Remove unused local variables
>
>     They were bound to specials before the tidy ups I did with PQUOTIENT
> and
>     I didn't notice the aux variables left over.
>
> diff --git a/src/rat3a.lisp b/src/rat3a.lisp
> index 8d63256..8efe8a8 100644
> --- a/src/rat3a.lisp
> +++ b/src/rat3a.lisp
> @@ -716,7 +716,7 @@
>  ;;
>  ;; Exactly divide two polynomials in the same variable, represented here
> by the
>  ;; list of their terms.
> -(defun ptptquotient (u v &aux q* (k 0))
> +(defun ptptquotient (u v)
>    ;; The algorithm is classic long division. You notice that if X/Y = Q
> then X =
>    ;; QY, so lc(X) = lc(Q)lc(Y) (where lc(Q)=Q when Q is a bare
> coefficient). Now
>    ;; divide again in the ring of coefficients to see that lc(X)/lc(Y) =
>
> commit fa3fff42abdbb571bb96db139e1a34c7d7c890c7
> Author: Rupert Swarbrick <rswarbrick at gmail.com>
> Date:   Fri Dec 6 21:10:06 2013 +0000
>
>     Document / rename PTERM
>
>     The function gets a term from the list representing the terms of a
>     polynomial (ie the CDR of an actual polynomial), so renaming to PTTERM
>     accordingly.
>
> diff --git a/src/algfac.lisp b/src/algfac.lisp
> index b9ac28a..3bc53b9 100644
> --- a/src/algfac.lisp
> +++ b/src/algfac.lisp
> @@ -104,7 +104,7 @@
>    (prog nil
>     loop (when (zerop n) (return vec))
>     (decf n)
> -   (push (pterm p n) vec)
> +   (push (ptterm p n) vec)
>     (go loop)))
>
>  (defun zassg (g f var)
> diff --git a/src/algsys.lisp b/src/algsys.lisp
> index 16dee9f..9887360 100644
> --- a/src/algsys.lisp
> +++ b/src/algsys.lisp
> @@ -273,8 +273,8 @@
>    (cond ((pconstp poly) nil)
>         ((pconstp (caddr poly))
>          (cons (cons (car poly) (cadr poly))
> -              (getvardegs (pterm (cdr poly) 0))))
> -       (t (getvardegs (pterm (cdr poly) 0)))))
> +              (getvardegs (ptterm (cdr poly) 0))))
> +       (t (getvardegs (ptterm (cdr poly) 0)))))
>
>  (declare-top (unspecial *vardegs*))
>
> diff --git a/src/combin.lisp b/src/combin.lisp
> index a6b9798..fb2b804 100644
> --- a/src/combin.lisp
> +++ b/src/combin.lisp
> @@ -1469,11 +1469,11 @@
>                                            (cons (ratplus
>                                                   (rattimes
>                                                    (cadr l)
> -                                                  (cons (pterm (cdaadr a)
> 1)
> +                                                  (cons (ptterm (cdaadr
> a) 1)
>                                                          (cdadr a))
>                                                    t)
>                                                   (cons
> -                                                  (pterm (cdaadr a) 0)
> +                                                  (ptterm (cdaadr a) 0)
>                                                    (cdadr a)))
>                                                  (cddr l))))
>                                   ((equal (cadr a)
> @@ -1509,11 +1509,11 @@
>                                      (cons (ratplus
>                                             (rattimes
>                                              (cadr l)
> -                                            (cons (pterm (cdaadr a) 1)
> +                                            (cons (ptterm (cdaadr a) 1)
>                                                    (cdadr a))
>                                              t)
>                                             (cons
> -                                            (pterm (cdaadr a) 0)
> +                                            (ptterm (cdaadr a) 0)
>                                              (cdadr a)))
>                                            (cddr l))))
>                             ((equal (cadr a)
> @@ -1545,7 +1545,7 @@
>                    (t (return nil)))))))
>
>  (defun pdecomp (p *var*)
> -  (let ((c (pterm (cdr p) 0))
> +  (let ((c (ptterm (cdr p) 0))
>         (a) (*x* (list *var* 1 1)))
>      (cons (pcplus c (car (setq a (pdecomp* (pdifference p c)))))
>           (cdr a))))
> diff --git a/src/csimp.lisp b/src/csimp.lisp
> index eedbbc5..2494bdb 100644
> --- a/src/csimp.lisp
> +++ b/src/csimp.lisp
> @@ -330,12 +330,12 @@
>            ((equal e '(0 . 1))
>             (setq c 0)
>             (go loop)))
> -     (setq c (pterm (cdar e) 1))
> +     (setq c (ptterm (cdar e) 1))
>       loop (cond ((atom c)
>                  (cond ((equal c 0) (return nil))
>                        ((equal 1 d) (return c))
>                        (t (return (list '(rat) c d))))))
> -     (setq c (pterm (cdr c) 0))
> +     (setq c (ptterm (cdr c) 0))
>       (go loop)))
>
>  (defun spang1 (j ind)
> diff --git a/src/defint.lisp b/src/defint.lisp
> index dd6365f..f2a270f 100644
> --- a/src/defint.lisp
> +++ b/src/defint.lisp
> @@ -1395,7 +1395,7 @@ in the interval of integration.")
>                         `((%log) ,var))
>                 (not (atom (cdr exp)))
>                 (equal (cadr (cdr exp)) 2.)
> -               (not (equal (pterm (cddr exp) 0.) 0.)))
> +               (not (equal (ptterm (cddr exp) 0.) 0.)))
>            (setq exp (mapcar 'pdis (cdr (oddelm (cdr exp)))))))))
>
>  (defun mtoinf (grand var)
> @@ -2633,7 +2633,7 @@ in the interval of integration.")
>
>  (defun coefsolve (n cl e)
>    (do (($breakup)
> -       (eql (ncons (pdis (pterm e n))) (cons (pdis (pterm e m)) eql))
> +       (eql (ncons (pdis (ptterm e n))) (cons (pdis (ptterm e m)) eql))
>         (m (m+ n -1) (m+ m -1)))
>        ((signp l m) (solvex eql cl nil nil))))
>
> @@ -3210,9 +3210,9 @@ in the interval of integration.")
>       (setq varlist (list var))
>       (newvar e)
>       (setq e (cdadr (ratrep* e)))
> -     (setq c (pdis (pterm e 0)))
> -     (setq b (m*t (m//t 1 2) (pdis (pterm e 1))))
> -     (setq a (pdis (pterm e 2)))
> +     (setq c (pdis (ptterm e 0)))
> +     (setq b (m*t (m//t 1 2) (pdis (ptterm e 1))))
> +     (setq a (pdis (ptterm e 2)))
>       (cond ((and (eq ($asksign (m+ b (m^ (m* a c)
>                                          '((rat) 1 2))))
>                      '$pos)
> diff --git a/src/factor.lisp b/src/factor.lisp
> index 645c1a7..1f23d77 100644
> --- a/src/factor.lisp
> +++ b/src/factor.lisp
> @@ -153,7 +153,7 @@
>
>  (defun estcheck (p)
>    (prog (lc c d)
> -     (cond ((or (atom p) (null (cddr p)) (equal (pterm p 0) 0))
> +     (cond ((or (atom p) (null (cddr p)) (equal (ptterm p 0) 0))
>             (return nil)))
>       (setq lc (cadr p))
>       (setq p (nreverse (cdr (oddelm (cdr p)))))
> @@ -276,7 +276,7 @@
>
>  (defun consta (p)
>    (cond ((or (pcoefp p) (alg p)) p)
> -       (t (consta (pterm (cdr p) 0)))))
> +       (t (consta (ptterm (cdr p) 0)))))
>
>  (defun constacl (p)                    ;NO LONGER USED?
>    (cond ((atom p)
> @@ -594,7 +594,7 @@
>       (go a)))
>
>  (defun sqfrp (u var)
> -  (cond ((and (equal 0 (pterm (cdr u) 0)) (equal 0 (pterm (cdr u) 1)))
> +  (cond ((and (equal 0 (ptterm (cdr u) 0)) (equal 0 (ptterm (cdr u) 1)))
>          nil)
>         ((onevarp u)
>          (setq u (pgcd u (pderivative u var)))
> diff --git a/src/hayat.lisp b/src/hayat.lisp
> index 8ee048d..51e28fb 100644
> --- a/src/hayat.lisp
> +++ b/src/hayat.lisp
> @@ -745,7 +745,7 @@
>  (defun psfind-s1 (r)
>     (cond ((null (atom (cdr r))) (rczero))
>          ((atom (car r)) r)
> -        (t (do ((p (pterm (cdar r) 0) (pterm (cdr p) 0)))
> +        (t (do ((p (ptterm (cdar r) 0) (ptterm (cdr p) 0)))
>                 ((atom p) (cons p (cdr r)))))))
>
>  (defun psexpt (p n)
> diff --git a/src/nalgfa.lisp b/src/nalgfa.lisp
> index 0b9ab00..5575b35 100644
> --- a/src/nalgfa.lisp
> +++ b/src/nalgfa.lisp
> @@ -28,7 +28,7 @@
>    (cond ((pcoefp p) p) ;;expression for any var in p
>         ((eq var (car p))
>          (cond ((pzerop val)
> -               (pterm (cdr p) 0))
> +               (ptterm (cdr p) 0))
>                ((do ((ld (cadr p) (car a))
>                      (a (cdddr p) (cddr a))
>                      (ans (caddr p)
> @@ -293,8 +293,8 @@
>                        prim (car temp))))))))
>
>  (defun plsolve (p)
> -  (ratreduce (pterm (cdr p) 0)
> -            (pminus (pterm (cdr p) 1))))
> +  (ratreduce (ptterm (cdr p) 0)
> +            (pminus (ptterm (cdr p) 1))))
>
>
>  (defun psplit-field1 (p)
> @@ -363,7 +363,7 @@
>          (cons p 1)) ;;expression for any var in p
>         ((eq var (car p))
>          (cond ((pzerop val)
> -               (cons (pterm (cdr p) 0) 1))
> +               (cons (ptterm (cdr p) 0) 1))
>                ((do ((ld (cadr p) (car a))
>                      (a (cdddr p) (cddr a))
>                      (ans (cons (caddr p) 1)
> diff --git a/src/nrat4.lisp b/src/nrat4.lisp
> index f35546d..65d1e14 100644
> --- a/src/nrat4.lisp
> +++ b/src/nrat4.lisp
> @@ -286,7 +286,7 @@
>         ((pointergp (car a) (car b)) (pzero))
>         ((eq (car a) (car b))
>          (cond ((null (cdddr a))
> -               (prodcoef (caddr a) (pterm (cdr b) (cadr a))))
> +               (prodcoef (caddr a) (ptterm (cdr b) (cadr a))))
>                (t (sumcoef a b))))
>         (t (prodcoef1 a b))))
>
> diff --git a/src/polyrz.lisp b/src/polyrz.lisp
> index 9979bb8..15d6a65 100644
> --- a/src/polyrz.lisp
> +++ b/src/polyrz.lisp
> @@ -148,7 +148,7 @@
>
>  (defun reval (p r)
>    (cond ((pcoefp p) (signum p))
> -       ((zerop (car r)) (signum (pterm (cdr p) 0)))
> +       ((zerop (car r)) (signum (ptterm (cdr p) 0)))
>         (t (prog (a b bi v m c)
>               (setq bi 1)
>               (setq v 0)
> diff --git a/src/psolve.lisp b/src/psolve.lisp
> index 6f91fa5..16d6010 100644
> --- a/src/psolve.lisp
> +++ b/src/psolve.lisp
> @@ -23,10 +23,10 @@
>       (setq adiv3
>            (list '(mtimes)
>                  '((rat) -1 3)
> -                (rdis (setq a2 (ratreduce (pterm x 2)
> +                (rdis (setq a2 (ratreduce (ptterm x 2)
>                                            lcoef)))))
> -     (setq a1 (ratreduce (pterm x 1) lcoef))
> -     (setq a0 (ratreduce (pterm x 0) lcoef))
> +     (setq a1 (ratreduce (ptterm x 1) lcoef))
> +     (setq a0 (ratreduce (ptterm x 0) lcoef))
>       (setq s1 '((mtimes)
>                 ((rat) 1 2)
>                 $%i
> @@ -130,10 +130,10 @@
>  (defmfun solvequartic (x)
>    (prog (a0 a1 a2 b1 b2 b3 b0 lcoef z1 r tr1 tr2 d d1 e sqb3)
>       (setq x (cdr x) lcoef (cadr x))
> -     (setq b3 (ratreduce (pterm x 3) lcoef))
> -     (setq b2 (ratreduce (pterm x 2) lcoef))
> -     (setq b1 (ratreduce (pterm x 1) lcoef))
> -     (setq b0 (ratreduce (pterm x 0) lcoef))
> +     (setq b3 (ratreduce (ptterm x 3) lcoef))
> +     (setq b2 (ratreduce (ptterm x 2) lcoef))
> +     (setq b1 (ratreduce (ptterm x 1) lcoef))
> +     (setq b0 (ratreduce (ptterm x 0) lcoef))
>       (setq a2 (ratminus b2))
>       (setq a1 (ratdif (rattimes b1 b3 t)
>                       (setq a0 (rattimes b0 '(4 . 1) t))))
> diff --git a/src/rat3a.lisp b/src/rat3a.lisp
> index 827189a..8d63256 100644
> --- a/src/rat3a.lisp
> +++ b/src/rat3a.lisp
> @@ -422,7 +422,7 @@
>    (if (eql val 0)
>        ;; If we're substituting 0 for the value, then we just extract the
>        ;; constant term.
> -      (pcsub (pterm terms 0) vals vars)
> +      (pcsub (ptterm terms 0) vals vars)
>        ;; Otherwise, walk through the polynomial using Horner's scheme to
>        ;; evaluate it. Because the polynomial is sparse, you can't just
> multiply
>        ;; by VAL every step, and instead have to keep track of the jump in
> @@ -835,12 +835,15 @@
>          (setf (cdr p) (pt-red (cdr p)))
>          (setq p (cddr p)))))
>
> -(defun pterm  (p n)
> -  (do ((p p (pt-red p)))
> -      ((ptzerop p) (pzero))
> -    (cond ((< (pt-le p) n) (return (pzero)))
> -         ((= (pt-le p) n) (return (pt-lc p))))))
> -
> +;; PTTERM
> +;;
> +;; Given X representing the terms of a polynomial in a variable z, return
> the
> +;; coefficient of z^n.
> +(defun ptterm (x n)
> +  (do ((x x (pt-red x)))
> +      ((ptzerop x) (pzero))
> +    (cond ((< (pt-le x) n) (return (pzero)))
> +         ((= (pt-le x) n) (return (pt-lc x))))))
>
>  (defmfun ptimes (x y)
>    (cond ((pcoefp x) (if (pzerop x) (pzero) (pctimes x y)))
> diff --git a/src/rat3d.lisp b/src/rat3d.lisp
> index e85b21c..d938641 100644
> --- a/src/rat3d.lisp
> +++ b/src/rat3d.lisp
> @@ -336,8 +336,8 @@
>                    p (pquotient p (list (car gv) (car dl) 1)))))))
>
>  (defun factorout (p)
> -  (cond ((and (pcoefp (pterm (cdr p) 0))
> -             (not (zerop (pterm (cdr p) 0))))
> +  (cond ((and (pcoefp (ptterm (cdr p) 0))
> +             (not (zerop (ptterm (cdr p) 0))))
>          (list nil p))
>         (t (factorout1 (pmindegvec p) p))))
>
> diff --git a/src/ratout.lisp b/src/ratout.lisp
> index f418dd2..74812a4 100644
> --- a/src/ratout.lisp
> +++ b/src/ratout.lisp
> @@ -100,7 +100,7 @@
>       (cond ((null p) (return *res))
>            ((pcoefp (cadr p))
>             (cond ((equal *max 0) (setq zz (cadr p)) (go add)) (t (go
> ret))))
> -          ((eq (caadr p) *var) (setq zz (pterm (cdadr p) *max)) (go add)))
> +          ((eq (caadr p) *var) (setq zz (ptterm (cdadr p) *max)) (go
> add)))
>       (cond ((equal *max 0) (setq zz (cadr p))) (t (go ret)))
>       add  (cond ((equal zz 0) (go ret)))
>       (setq *res (pplus *res (psimp *chk (list (car p) zz))))
> diff --git a/src/simp.lisp b/src/simp.lisp
> index 25104df..01db0a4 100644
> --- a/src/simp.lisp
> +++ b/src/simp.lisp
> @@ -3520,7 +3520,7 @@
>
>  (defmfun polcoef (l n) (cond ((or (atom l) (pointergp var (car l)))
>                               (cond ((equal n 0) l) (t 0)))
> -                            (t (pterm (cdr l) n))))
> +                            (t (ptterm (cdr l) n))))
>
>  (defun disrep (l) (cond ((equal (ratnumerator l) l)
>                          ($ratdisrep (cons ratform (cons l 1))))
> diff --git a/src/solve.lisp b/src/solve.lisp
> index 8dfe11b..bf9a59f 100644
> --- a/src/solve.lisp
> +++ b/src/solve.lisp
> @@ -771,9 +771,9 @@
>  ;; This function is called for side-effect only.
>
>  (defun solvelin (exp)
> -  (cond ((equal 0 (pterm (cdr exp) 0))
> +  (cond ((equal 0 (ptterm (cdr exp) 0))
>          (solve1a (caddr exp) mult)))
> -  (solve3 (rdis (ratreduce (pminus (pterm (cdr exp) 0))
> +  (solve3 (rdis (ratreduce (pminus (ptterm (cdr exp) 0))
>                            (caddr exp)))
>           mult))
>
> @@ -784,8 +784,8 @@
>
>  (defun solvequad (exp &aux discrim a b c)
>    (setq a (caddr exp))
> -  (setq b (pterm (cdr exp) 1.))
> -  (setq c (pterm (cdr exp) 0.))
> +  (setq b (ptterm (cdr exp) 1.))
> +  (setq c (ptterm (cdr exp) 0.))
>    (setq discrim (simplify (pdis (pplus (pexpt b 2.)
>                                        (pminus (ptimes 4. (ptimes a
> c)))))))
>    (setq b (pdis (pminus b)))
>
> -----------------------------------------------------------------------
>
> Summary of changes:
>  src/algfac.lisp |    2 +-
>  src/algsys.lisp |    4 ++--
>  src/combin.lisp |   10 +++++-----
>  src/csimp.lisp  |    4 ++--
>  src/defint.lisp |   10 +++++-----
>  src/factor.lisp |    6 +++---
>  src/hayat.lisp  |    2 +-
>  src/nalgfa.lisp |    8 ++++----
>  src/nrat4.lisp  |    2 +-
>  src/polyrz.lisp |    2 +-
>  src/psolve.lisp |   14 +++++++-------
>  src/rat3a.lisp  |   19 +++++++++++--------
>  src/rat3d.lisp  |    4 ++--
>  src/ratout.lisp |    2 +-
>  src/simp.lisp   |    2 +-
>  src/solve.lisp  |    8 ++++----
>  16 files changed, 51 insertions(+), 48 deletions(-)
>
>
> hooks/post-receive
> --
> Maxima CAS
>
>
> ------------------------------------------------------------------------------
> Sponsored by Intel(R) XDK
> Develop, test and display web and hybrid apps with a single code base.
> Download it for free now!
>
> http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
> _______________________________________________
> Maxima-commits mailing list
> Maxima-commits at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/maxima-commits
>