plotting numeric functions




On Mon, 24 May 2010, James Limbouris wrote:

< On Mon, 24 May 2010 17:36:52 +0800, Leo Butler <l.butler at ed.ac.uk> wrote:
< 
< > 
< > 
< > On Mon, 24 May 2010, James Limbouris wrote:
< > < On my machine I get:
< > <
< > < Maxima encountered a Lisp error:
< > < Error in LET* [or a callee]: The storage for LONG-FLOAT is exhausted.
< > < Currently, 8027 pages are allocated.
< > < Use ALLOCATE to expand the space.
< > < Automatically continuing.
< > < To enable the Lisp debugger set *debugger-hook* to nil.
< > <
< > < after about 2 minutes, with wxMaxima 0.8.5 and Maxima 5.21.1.
< > < The machine has a good deal of RAM, so I'm assuming that's not a problem.
< > <
< > < I also tried the same lambda line with abs and f quoted, but no luck yet.
< > James, could you send us the output of
< > 
< > build_info();
< > 
< > I suspect that the issue is GCL.
< > 
< > Leo
< > 
< 
< It's:
< 
< Maxima version: 5.21.1
< Maxima build date: 8:13 4/26/2010
< Host type: i686-pc-mingw32
< Lisp implementation type: GNU Common Lisp (GCL)
< Lisp implementation version: GCL 2.6.8
< 
< Did you get it to work in the example file? If so, please send it to me - it
< may be I made a mistake testing it.
< 
< Thanks,
< James
< 

James, after playing around a bit, I think the problem is simply that
compiling your function exhausts all heap space (1G in my case). I don't
know if this is a bug in Maxima's compiler (probably), but there is
a work-around adapted from the plot3d info page.

f(nr,ni) := block(mode_declare([nr,ni],float), ...)$
translate(f)$

block([h:.01,N:10,M,F],
  local(F),
  M:genmatrix(lambda([i,j],apply(f,[i*h,j*h])),N,N),
  F(x,y):=abs('M[round(x),round(y)]),
  plot3d(F(x/h,y/h),[x,h,N*h],[y,h,N*h],[grid,N,N]));

Leo

-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.