In the attached file, I defined the function f as f(x,y,z) = x^2 + y^2 + z^2 and then I tried to define the function g as the Laplacian of the function f as the Laplacian of the function f. However, as shown in the attached file, it doesn’t generate g[1,1,1].
Any help would be appreciated.
I think you used x in place of z in your definition of g:
Laplacian[x^2 + y^2 + z^2, {x, y, x}]
Shouldn’t it be:
Laplacian[x^2 + y^2 + z^2, {x, y, z}]
?
But even after that fix, I think you’re still going to have a problem. When you try to evaluate g[1,1,1] it will do all of the argument replacements first, and you’ll end up with Laplacian[3, {1, 1, 1}].
You can constrain the arguments to be symbols, or you can use ReplaceAll, or us a scoping construct to “localize” the formal variables (or some combination). Not sure if this is the best way, but something to start/play with: