[Maxima] problem with dpart

Barton Willis willisb at unk.edu
Thu May 17 07:38:50 CDT 2007

-----maxima-bounces at math.utexas.edu wrote: -----

>To: maxima at math.utexas.edu
>From: Andreas Eder <aeder at arcor.de>
>Sent by: maxima-bounces at math.utexas.edu
>Date: 05/17/2007 03:53AM
>Subject: [Maxima] problem with dpart
>There is a problem somewhere which manifests itself in dpart,
>though I think its roots must be somewhere else.
>To begin with, look at the docs to rembox and you will see (among
>other things):
>          (%i1) expr: (a*d - b*c)/h^2 + sin(%pi*x);

>but dpart (dpart (expr, 1, 1), 2, 2);
>give an error:
>dpart fell off end.
> -- an error.  To debug this try debugmode(true);
>which is no wonder, because you will see that somehow in
>(%i4) dpart (expr, 1, 1);
>                          a d - b c         """""""
>(%o4)                     --------- - sin(- "%pi x")
>                              2             """""""
>                             h
>we have managed to introduce minus signs and switch from sin(x) to
>- sin(-x).
>Where does that come from? Has anybody got an idea?
To see how this happens, trace simp-%sin and apply-reflection-simp:

(%i5) dpart (expr, 1, 1);
  1> (SIMP-%SIN ((%SIN) ((MBOX) ((MTIMES) $%PI $X))) 1 NIL)
           ((MBOX SIMP) ((MTIMES SIMP) $%PI $X)) T)
           ((MTIMES SIMP) -1
            ((%SIN SIMP)
             ((MTIMES SIMP) -1 ((MBOX SIMP) ((MTIMES SIMP) $%PI $X))))))
  <1 (SIMP-%SIN
         ((MTIMES SIMP) -1
          ((%SIN SIMP)
           ((MTIMES SIMP) -1 ((MBOX SIMP) ((MTIMES SIMP) $%PI $X))))))

You'll also need to look at the source for apply-reflection-simp

(defun apply-reflection-simp (op x &optional (b t))
  (let ((f (get op 'reflection-rule)))
    (if (and b f (great (neg x) x)) (funcall f op x) nil)))


(a) tell apply-reflection-simp to ignore mbox
(b) return to the sign based scheme for applying reflection identities
(c) ?

Barton (author of apply-reflection-simp)

More information about the Maxima mailing list