[Maxima] [Maxima-commits] CVS: maxima/src gamma.lisp,1.44,1.45
Dieter Kaiser
drdieterkaiser at web.de
Wed Nov 18 13:41:13 CST 2009
Am Mittwoch, den 18.11.2009, 09:34 -0500 schrieb Raymond Toy:
> Wouldn't it have been better to modify div so that div of two integers
> automatically returned a simplified rat expression? Then every user of
> div gets this fix.
First, I have changed (div 1 2) --> ((rat simp) 1 2) because I think
this is the most simple and efficient way to represent a constant
rational. Most code of Maxima does it this way too. I have implemented
rational constants with DIV at a time I did not know much about the way
Maxima simplifies expressions.
The function DIV needs a lot of function calls to get the same result.
Furthermore, I think that it is not a good idea to modify the function
DIV. DIV is a general shortcut to call the simplifier, but we do not
need to call the simplifier for a constant expression.
We have some more ways in Maxima to get the rational constant ((rat
simp) 1 2). These macros and variables are defined in Maxima core:
(defvar 1//2 '((rat simp) 1 2))
(defmacro 1//2 () ''((rat simp) 1 2)) ;1/2
(defmacro half () ''((rat simp) 1 2)) ;1/2
(defmvar 1//2 '((rat simp) 1 2))
Dieter Kaiser
More information about the Maxima
mailing list