Computes the numerical Laplacian of functions
or the symbolic Laplacian of characters
in arbitrary orthogonal coordinate systems.
laplacian( f, var, params = list(), coordinates = "cartesian", accuracy = 4, stepsize = NULL, drop = TRUE ) f %laplacian% var
f  array of 

var  vector giving the variable names with respect to which the derivatives are to be computed and/or the point where the derivatives are to be evaluated. See 
params 

coordinates  coordinate system to use. One of: 
accuracy  degree of accuracy for numerical derivatives. 
stepsize  finite differences stepsize for numerical derivatives. It is based on the precision of the machine by default. 
drop  if 
Scalar for scalarvalued functions when drop=TRUE
, array
otherwise.
The Laplacian is a differential operator given by the divergence of the
gradient of a scalarvalued function \(F\), resulting in a scalar value giving
the flux density of the gradient flow of a function.
The laplacian
is computed in arbitrary orthogonal coordinate systems using
the scale factors \(h_i\):
$$\nabla^2F = \frac{1}{J}\sum_i\partial_i\Biggl(\frac{J}{h_i^2}\partial_iF\Biggl)$$
where \(J=\prod_ih_i\). When the function \(F\) is a tensorvalued function
\(F_{d_1\dots d_n}\), the laplacian
is computed for each scalar component:
$$(\nabla^2F)_{d_1\dots d_n} = \frac{1}{J}\sum_i\partial_i\Biggl(\frac{J}{h_i^2}\partial_iF_{d_1\dots d_n}\Biggl)$$
%laplacian%
: binary operator with default parameters.
Guidotti, E. (2020). "calculus: High dimensional numerical and symbolic calculus in R". https://arxiv.org/abs/2101.00086
Other differential operators:
curl()
,
derivative()
,
divergence()
,
gradient()
,
hessian()
,
jacobian()
#> [1] "3 * (2 * x) + 3 * (2 * y) + 3 * (2 * z)"### numerical Laplacian in (x=1, y=1, z=1) f < function(x, y, z) x^3+y^3+z^3 laplacian(f = f, var = c(x=1, y=1, z=1))#> [1] 18#> [1] 18### symbolic vectorvalued functions f < array(c("x^2","x*y","x*y","y^2"), dim = c(2,2)) laplacian(f = f, var = c("x","y"))#> [,1] [,2] #> [1,] "2" "0" #> [2,] "0" "2"### numerical vectorvalued functions f < function(x, y) array(c(x^2,x*y,x*y,y^2), dim = c(2,2)) laplacian(f = f, var = c(x=0,y=0))#> [,1] [,2] #> [1,] 2 0 #> [2,] 0 2#> [1] "3 * (2 * x) + 3 * (2 * y) + 3 * (2 * z)"