Plot 2D & 3D - Variables Range



Raymond Toy  writes:

[CHECK-RANGE doesn't like some sorts of numbers]
> I don't understand how the original version works with %pi/2 but
> doesn't work with 5/2.

I think this is because of

(let (($numer t)) #$%pi/2$) => 1.5707963267948966

(let (($numer t)) #$5/2$) => ((RAT SIMP) 5 2)

Looking at *RED (in simp.lisp), it seems that we should also bind
$FLOAT.  This behaviour is not visible from the Maxima top-level
because $NUMER is connected to $FLOAT via its ASSIGN property
resp. some code in $EV.

So the following patch might work (but I am not familiar with the
plotting code).

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cut ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Index: plot.lisp
===================================================================
RCS file: /cvsroot/maxima/maxima/src/plot.lisp,v
retrieving revision 1.45
diff -u -r1.45 plot.lisp
--- plot.lisp	18 Nov 2004 15:20:28 -0000	1.45
+++ plot.lisp	26 Jan 2005 02:05:02 -0000
@@ -1684,7 +1684,7 @@
 128 .8 1 0
 " ncolors))
 
-(defun check-range (range &aux ($numer t) tem a b)
+(defun check-range (range &aux ($numer t) ($float t) tem a b)
   (or (and ($listp range)
 	   (setq tem (cdr range))
 	   (symbolp (car tem))
@@ -1693,7 +1693,7 @@
 	   (< a b)
 	   )
       (merror "Bad Range ~%~M must be of the form [variable,min,max]" range))
-  `((mlist) ,(car tem) ,(float a) ,(float b)))
+  (rplacd range (list (car tem) (float a) (float b))))
 
 (defun $zero_fun (x y) x y 0.0)
 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cut ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Instead of the aggressive RPLACD one could also simply
(setq range (check-range range)) in $PLOT2D, the same way the other
plotting functions do this.

Wolfgang