Laplacian of symbolic field
Laplacian of Scalar Field
Create a symbolic function for the scalar field . Compute the Laplacian of this function with respect to the vector .
syms x y z f(x,y,z) = sin(x) + y^2 + z^3; v = [x y z]; lf = laplacian(f,v)
lf(x, y, z) =
Create another scalar field . Find the Laplacian without specifying the vector to differentiate with. Because
g is a function of symbolic scalar variables,
laplacian finds the Laplacian of
g with respect to the default variables as defined by
g(x,y,z) = x^2*y + z; lg = laplacian(g)
lg(x, y, z) =
Laplacian of Vector Field
Create a symbolic vector field . Find the Laplacian of this vector field with respect to .
syms x y z F = [sin(x) + y^2 + z^3; x^2*y + z]; v = [x y z]; l = laplacian(F,v)
Find Vector Calculus Identities Involving Laplacian
Create a 3-by-1 vector as a symbolic matrix variable . Create a scalar field that is a function of as a symbolic matrix function , keeping the existing definition of .
syms X [3 1] matrix syms psi(X) [1 1] matrix keepargs
Show that the divergence of the gradient of is equal to the Laplacian of , that is .
divOfGradPsi = divergence(gradient(psi,X),X)
lapPsi = laplacian(psi,X)
Create a vector field that is a function of as a symbolic matrix function .
syms A(X) [3 1] matrix keepargs
Show that the gradient of the divergence of minus the curl of the curl of is equal to the Laplacian of , that is .
identityA = gradient(divergence(A,X),X) - curl(curl(A,X),X)
f — Symbolic field
symbolic expression | symbolic function | symbolic matrix variable | symbolic matrix function
Symbolic field, specified as a symbolic expression, symbolic function, symbolic matrix variable, or symbolic matrix function. The input field can be a scalar, vector, matrix, or a multidimensional array, where the Laplacian is computed for each element in the input.
fis a function of symbolic scalar variables, where
fis of type
symfun, then the vector
vmust be of type
fis a function of symbolic matrix variables, where
fis of type
symfunmatrix, then the vector
vmust be of type
v — Vector with respect to which you find the Laplacian
vector of symbolic scalar variables | symbolic function | symbolic matrix variable | symbolic matrix function
Vector with respect to which you find the Laplacian, specified as a vector of symbolic scalar variables, symbolic function, symbolic matrix variable, or a symbolic matrix function.
If you do not specify
fis a function of symbolic scalar variables, then, by default,
vfrom the symbolic scalar variables in
fwith the order of variables as defined by
vis a symbolic matrix variable of type
vmust have a size of
vis scalar, then
laplacian(f,v) = diff(f,2,v).
Symbolic Math Toolbox™ currently does not support the
crossfunctions for symbolic matrix variables and functions of type
symfunmatrix. If vector calculus identities involve dot or cross products, then the toolbox displays those identities in terms of other supported functions instead. To see a list of all the functions that support symbolic matrix variables and functions, use the commands
If the input data type of the symbolic field
laplaciandoes not evaluate the partial derivatives of
f. Instead, it returns an unevaluated formula for symbolic manipulation and formula rearrangement.
The Laplacian or Laplace's differential operator of the scalar field f with respect to the vector x = (x1,...,xn) is the sum of the second derivatives of f with respect to x1,...,xn.
If f is a vector field or a tensor field (multidimensional array), then the Laplacian operator is applied to each element in f.
The Laplacian of a scalar function or functional expression is the divergence of the gradient of that function or expression.
For a symbolic scalar field
f, you can also compute the Laplacian using
syms f(x,y) divergence(gradient(f(x,y)),[x y])
Version HistoryIntroduced in R2012a
R2023a: Compute Laplacian of symbolic matrix variables, functions, and multidimensional arrays
laplacian function accepts symbolic matrix variables and
functions of type
symfunmatrix as input
arguments. For example, see Find Vector Calculus Identities Involving Laplacian.
You can also compute the Laplacian of a multidimensional array
laplacian function computes the Laplacian for each element of
f and returns the output
l that is the same size
f. In previous releases,
f must be scalar. For
example, see Laplacian of Vector Field.