Not surprising. This expression:
plot3d(cabs(f(ky,kz)),[ky,-3,3],[kz,-3,3]);
means "calculate cabs(f(ky,kz)) as an argument to plot3d (without binding ky
and kz) -- call the result xxx; now evaluate xxx for various numeric values
of ky and kz". In other words, it first calculates a *symbolic expression*
for the absolute value, then evaluates that at various values. What you
want to do is presumably calculate the *numeric values* of f(ky,kz) at
various values and then take the cabs of that. You can do that with:
plot3d( '( cabs(f(ky,kz)) ),[ky,-3,3],[kz,-3,3]);
which should have the same effect as your plot3d(abs_f,...) expression.
-s
2010/1/7 Stanislav Maslovski <stanislav.maslovski at gmail.com>
> On Thu, Jan 07, 2010 at 10:10:20AM -0500, Stavros Macrakis wrote:
> > Until the cabs/abs problem is resolved, there is a workaround for your
> problem,
> > namely to define a function which first calculates the complex numerical
> value,
> > and only then calls abs, something like this:
> >
> > Instead of
> >
> > plot3d( abs(f(x,y)), ...)
> >
> > use
> >
> > fff(x,y) := block([temp], temp: float(f(x,y)), cabs(temp) )
> >
> > plot3d( '(fff(x,y)), ...)
> >
> > Let us know if this helps.
>
> I have tried the following. I appended these lines to the code I sent to
> this list earlier:
>
> f(ky,kz) := ''(subst(k0=%i,Ree));
>
> abs_f(ky,kz) := cabs(f(ky,kz));
>
> plot3d(abs_f,[ky,-3,3],[kz,-3,3]);
>
> plot3d(cabs(f(ky,kz)),[ky,-3,3],[kz,-3,3]);
>
> The first plot works, the second one runs forever.
>
> --
> Stanislav
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>