I have 3D Gaussians and their derivatives (Laplace operator)
f1(x,y,z):=exp(-w1*((x-x1)^2+y^2+z^2));
f2(x,y,z):=exp(-w2*(x^2+y^2+z^2));
dx2_f2(x,y,z):=diff(f2(x,y,z),x,2);
Lf2(x,y,z):=diff(f2(x,y,z),x,2) + diff(f2(x,y,z),y,2) + diff(f2(x,y,z),z,2);
Now I want to plot a profile along x
cutting the function for fixed y,z
for some values of parameters
w1:1.2;w2:0.5;x1:1.5;
plot2d( Lf2(x,0,0) ,[x,-5,5]);
I get following error
diff: second argument must be a variable; found 0
#0: Lf2(x=x,y=0,z=0)
-- an error. To debug this try: debugmode(true);
While plot2d( [f1(x,0,0),f2(x,0,0),dx2_f2(x,0,0)] ,[x,-5,5]);
works just fine.
The same error is if I try to partially substite the variables manually
Lf2x(x):=Lf2(x,0,0);
My guess, the problem is Maxima/lisp does some lazy evaluation, therefore the derivatives along y,z
are not yet calculated when I substitute them by y=0,z=0
. Therefore it refuse do derivative along constant (?).
But I don't know how to solve it (i.e. substitute the constant only after the derivatives are calculated)