problems with abs() and cabs()



On Thu, Jan 07, 2010 at 06:01:03PM -0500, Stavros Macrakis wrote:
> 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.

Sure. Then why

plot3d(sqrt(realpart(subst(k0=%i,Ree)^2+imagpart(k0=%i,Ree)^2),...)

still works (see the example I sent in my first mail)?

-- 
Stanislav