plot3d discrete problem



Hi Jaime,

I had not realised this was an example from the manual (it was a long time ago).

There seems to be a typo in your message but I have copied the code from the new 
manual and it works with both versions.

Many thanks fro your help.

Regards, Rob.



----- Original Message ----
From: Jaime Villate <villate at fe.up.pt>
To: Rob Burns <rob_g_burns at yahoo.co.uk>
Cc: maxima at math.utexas.edu
Sent: Sun, 20 February, 2011 15:37:21
Subject: Re: [Maxima] plot3d discrete problem

On Sat, 2011-02-19 at 12:46 +0000, Rob Burns wrote:
> This plot used to work in maxima 5.18.1 but does not now work.
> 
> (%i1) M: matrix([2, 2, 3, 5], [2, 1, 3, 2], [2, 2, 3, 4],
> 
>? ? ? ? [2, 2, 3, 3], [1,1,1,4])$
> (%i2) M;
> (%o2) matrix([2,2,3,5],[2,1,3,2],[2,2,3,4],[2,2,3,3],[1,1,1,4])
> (%i3) f(x, y) := float (M [?round(x), ?round(y)])$
> (%i4) plot3d (f, [x, 1, 5], [y, 1, 4], ['grid, 4, 4], ['xlabel, "x-axis"], 
> [plot_format, openmath])$

Hi Rob,
as explained in the manual, this example should be like this:

(%i1) M: matrix([1, 2, 3, 4], [1, 2, 3, 2], [1, 2, 3, 4],[1, 2, 3, 3])$
(%i2) f(x, y) := float('M [round(x round(y)])$
(%i3) plot3d (f(x,y), [x, 1, 4], [y, 1, 4], [grid, 4, 4], ['xlabel,
"x-axis"], [plot_format, openmath])$

you have to quote M in the definition of f and you can not call f(x,y)
just by its name in this case. There is now a round function defined in
Maxima, so you no longer have to use the lisp roud function.
Regards,
Jaime