Martin Kraska
2013-10-31 21:17:10 UTC
Leo,
indeed the approach has solved the problem. It also inspired the solution of a similar problem with expressions of type a^b^c.
I suppose, we are not compatible to GPLv2, as we do not make any particular license statement and the base program SMath is closed source and we are bundling our stuff with SMath (plugin distribution is via the SMath extension manager).
Currently, we distribute the files smath.mac and smath.lisp together with the plugin and place them in the install dir of SMath (which is not really nice).
Having them in the Maxima installation would be fine for us. We would then load them from our init files. This, however would be problematic with existing Maxima installations, as there is no convenient Maxima update procedure (at least under windows).
Do you see any clean way to handle that?
Martin Kraska
indeed the approach has solved the problem. It also inspired the solution of a similar problem with expressions of type a^b^c.
I suppose, we are not compatible to GPLv2, as we do not make any particular license statement and the base program SMath is closed source and we are bundling our stuff with SMath (plugin distribution is via the SMath extension manager).
Currently, we distribute the files smath.mac and smath.lisp together with the plugin and place them in the install dir of SMath (which is not really nice).
Having them in the Maxima installation would be fine for us. We would then load them from our init files. This, however would be problematic with existing Maxima installations, as there is no convenient Maxima update procedure (at least under windows).
Do you see any clean way to handle that?
Martin Kraska
-----Ursprüngliche Nachricht-----
Gesendet: Donnerstag, 31. Oktober 2013 14:55
An: Martin Kraska
Betreff: Re: AW: [Maxima] How to avoid ^- in maxima output? (Leo Butler)
for a while.
I don't know if your project has found the code that I wrote useful. If so, and you
wish to use it to provide a plugin to Maxima, then there is the issue of
distribution. I do not know if your licensing is compatible with GPLv2. If it is,
then please distribute the code with your plugins. If it is not *or* you are
unsure (and I suspect this is the case), then the code can be added to Maxima
under the share/contrib directory where it will be distributed under GPLv2.
Regards,
Leo
Robert
FORM."
Gesendet: Donnerstag, 31. Oktober 2013 14:55
An: Martin Kraska
Betreff: Re: AW: [Maxima] How to avoid ^- in maxima output? (Leo Butler)
Date: Thu, 24 Oct 2013 18:05:04 +0200
Leo,
thanks a lot for the great help.
I did not examine the code yet but I see that this might be the solution of
the given problem and I am glad to see that such problems can be handled
onLeo,
thanks a lot for the great help.
I did not examine the code yet but I see that this might be the solution of
the given problem and I am glad to see that such problems can be handled
the Maxima side. We would like to avoid any modification of existing
Maximainstallations and rather load the scripts from our plugin directory. I guess
that the search path for maxima can be extended accordingly.
Best regards, Martin
Martin, sorry for the delay in replying, my outbound email server has been downthat the search path for maxima can be extended accordingly.
Best regards, Martin
for a while.
I don't know if your project has found the code that I wrote useful. If so, and you
wish to use it to provide a plugin to Maxima, then there is the issue of
distribution. I do not know if your licensing is compatible with GPLv2. If it is,
then please distribute the code with your plugins. If it is not *or* you are
unsure (and I suspect this is the case), then the code can be added to Maxima
under the share/contrib directory where it will be distributed under GPLv2.
Regards,
Leo
-----Ursprüngliche Nachricht-----
Gesendet: Donnerstag, 24. Oktober 2013 16:48
An: Martin Kraska
Betreff: Re: [Maxima] How to avoid ^- in maxima output? (Leo Butler)
1dGesendet: Donnerstag, 24. Oktober 2013 16:48
An: Martin Kraska
Betreff: Re: [Maxima] How to avoid ^- in maxima output? (Leo Butler)
Date: Thu, 24 Oct 2013 01:09:02 +0200
Leo, thanks for the response ( and Robert, for your's as well).
Other examples are
"e^-cos(x)/b", misunderstood as e^{-cos(x)/b},
"e^-c/b" , misunderstood as e^{-c/b}
"e^(-cos(x))/b"
"e^(-c)/b"
Thus, how can Maxima be forced to bracket the unary minus operator in
Leo, thanks for the response ( and Robert, for your's as well).
Other examples are
"e^-cos(x)/b", misunderstood as e^{-cos(x)/b},
"e^-c/b" , misunderstood as e^{-c/b}
"e^(-cos(x))/b"
"e^(-c)/b"
Thus, how can Maxima be forced to bracket the unary minus operator in
output?
Ok, I do see what you want. My suggestion is basically what RJF andwere hinting at. What you can do is use Maxima's ability to apply
transformation rules to expressions to re-write the expression before it
istransformation rules to expressions to re-write the expression before it
(%i10) (to_mx_display(), kill(all), load("smath.mac"))$
(%i1) [e^-4, %e^-t/d, %e^-cos(x)/y];
(%o1) [1/e^4,%e^-t/d,%e^-cos(x)/y]
(%i2) to_sm_display();
(%s2) %s <-- change outchar for different
display mode(%i1) [e^-4, %e^-t/d, %e^-cos(x)/y];
(%o1) [1/e^4,%e^-t/d,%e^-cos(x)/y]
(%i2) to_sm_display();
(%s2) %s <-- change outchar for different
(%i3) [e^-4, %e^-t/d, %e^-cos(x)/y];
(%s3) [e^{-4},%e^{-t}/d,%e^{-cos(x)}/y] <-- desired output
(%i4) to_mx_display();
(%o4) %o <-- revert to maxima's standard
1d display(%s3) [e^{-4},%e^{-t}/d,%e^{-cos(x)}/y] <-- desired output
(%i4) to_mx_display();
(%o4) %o <-- revert to maxima's standard
(%i5) %s3;
(%o5) [1/e^4,%e^-t/d,%e^-cos(x)/y] <-- the expr in %s3 is valid
maxima(%o5) [1/e^4,%e^-t/d,%e^-cos(x)/y] <-- the expr in %s3 is valid
code
where
/* -*- Mode: maxima; Package: MAXIMA -*- */
/*
thewhere
/* -*- Mode: maxima; Package: MAXIMA -*- */
/*
terms of GPLv2 */
matchdeclare([sm_x],true,sm_y,lambda([e],if is(numberp(e) and e<0 and
e#-1)matchdeclare([sm_x],true,sm_y,lambda([e],if is(numberp(e) and e<0 and
or is(not(atom(e)) and op(e)="-") then true else false));
defrule(sm_exp_to_power,sm_x^sm_y,sm_x^{sm_y});
sm_rules:['sm_exp_to_power];
load("smath.lisp")$
/* end of smath.mac */
;; -*- mode: lisp -*-
thedefrule(sm_exp_to_power,sm_x^sm_y,sm_x^{sm_y});
sm_rules:['sm_exp_to_power];
load("smath.lisp")$
/* end of smath.mac */
;; -*- mode: lisp -*-
terms of GPLv2
(in-package :maxima)
(defvar *displa* (symbol-function 'displa)) (defvar *maxima-outchar*
$outchar)(in-package :maxima)
(defvar *displa* (symbol-function 'displa)) (defvar *maxima-outchar*
(defvar *smath-outchar* '$%s) (defvar $sm_rules)
(defun $smath_displa (form &optional (sm-rules $sm_rules))
"Display FORM by APPLY1-ing the rules in SM-RULES to the EXPR in
(defun $smath_displa (form &optional (sm-rules $sm_rules))
"Display FORM by APPLY1-ing the rules in SM-RULES to the EXPR in
(declare (special $sm_rules *alt-display1d*))
(let ((rules (cdr sm-rules))
(*alt-display1d* nil)
(expr (third form)))
(funcall *displa*
(list (first form) (second form)
(dolist (rule rules expr)
(setf expr (mfuncall '$apply1 expr rule)))))))
(defun $to_sm_display ()
"Set-up Maxima to use SMATH_DISPLA to display output."
(declare (special *alt-display1d* $outchar *smath-outchar*))
(setf *alt-display1d* (symbol-function '$smath_displa))
(setf $outchar *smath-outchar*))
(defun $to_mx_display ()
"Return Maxima to use standard DISPLA for 1d output."
(declare (special *alt-display1d* $outchar *maxima-outchar*))
(setf *alt-display1d* nil)
(setf $outchar *maxima-outchar*))
; end of smath.lisp
Leo
(let ((rules (cdr sm-rules))
(*alt-display1d* nil)
(expr (third form)))
(funcall *displa*
(list (first form) (second form)
(dolist (rule rules expr)
(setf expr (mfuncall '$apply1 expr rule)))))))
(defun $to_sm_display ()
"Set-up Maxima to use SMATH_DISPLA to display output."
(declare (special *alt-display1d* $outchar *smath-outchar*))
(setf *alt-display1d* (symbol-function '$smath_displa))
(setf $outchar *smath-outchar*))
(defun $to_mx_display ()
"Return Maxima to use standard DISPLA for 1d output."
(declare (special *alt-display1d* $outchar *maxima-outchar*))
(setf *alt-display1d* nil)
(setf $outchar *maxima-outchar*))
; end of smath.lisp
Leo