Problem with 'diff(x,x) tex conversion



On 10/16/08, Nathaniel E. Powell <nathan.powell at agilix.com> wrote:

> Would anyone like to tell me how much I would need to pay them to get #1
> fixed below and to send me a custom built windows installer (with the fix)
> and the patch file, and to file the patch so that hopefully it gets into the
> next release of Maxima?

If the stuff below solves your problem, maybe you can buy me a beer sometime.
Although I can't promise to always work for beer ....

I've attached superq.lisp which defines a new function superq
which is "super" quoting (it prevents simplification as well as evaluation).
Since I think that could be useful in other contexts, maybe I'll throw it into
share/contrib.

As it stands, super-quoted expressions can't be unquoted, and don't act
like their values (e.g. sin(0) => 0 but sin(superq(0)) => sin(superq(0))).
Not sure what properties super-quoted expressions ought to have.

HTH

Robert Dodier

PS.

;; superq.lisp -- "super" quoting for Maxima
;; Copyright 2008 by Robert Dodier
;; I release this work under the terms of the GNU General Public License

;; Examples:

;; load (superq);

;; '(1 + 1);
;;  => 2
;; superq (1 + 1);
;;  => superq(1 + 1)
;; '(5!);
;;  => 120
;; superq (5!);
;;  => superq(5!)
;; '(sin (0));
;;  => 0
;; superq (sin (0));
;;  => superq(sin(0))
;; '('diff (x, x, 1));
;;  => 1
;; superq('diff (x, x, 1));
;;  => superq('diff(x,x,1))

;; tex ('(1 + 1));
;;  => $$2$$
;; tex (superq (1 + 1));
;;  => $$1+1$$
;; tex ('(5!));
;;  => $$120$$
;; tex (superq (5!));
;;  => $$5!$$
;; tex ('(sin (0)));
;;  => $$0$$
;; tex (superq (sin (0)));
;;  => $$\sin 0$$
;; tex ('('diff (x, x, 1)));
;;  => $$1$$
;; tex (superq('diff (x, x, 1)));
;;  => $${{d}\over{d\,x}}\,x$$

(defmspec $superq (e) e)

(defun simp-$superq (x y z) (declare (ignore y z)) x)

(setf (get '$superq 'operators) 'simp-$superq)

(defun tex-$superq (x l r) (tex (second x) l r 'mparen 'mparen))

(setf (get '$superq 'tex) 'tex-$superq)