Accelerating the pace of engineering and science

# laplacian

Laplacian of scalar function

laplacian(f,x)
laplacian(f)

## Description

laplacian(f,x) computes the Laplacian of the scalar function or functional expression f with respect to the vector x in Cartesian coordinates.

laplacian(f) computes the gradient vector of the scalar function or functional expression f with respect to a vector constructed from all symbolic variables found in f. The order of variables in this vector is defined by symvar.

## Input Arguments

 f Symbolic expression or symbolic function. x Vector with respect to which you compute the Laplacian. Default: Vector constructed from all symbolic variables found in f. The order of variables in this vector is defined by symvar.

## Examples

Compute the Laplacian of this symbolic expression. By default, laplacian computes the Laplacian of an expression with respect to a vector of all variables found in that expression. The order of variables is defined by symvar.

```syms x y t
laplacian(1/x^3 + y^2 - log(t))```
```ans =
1/t^2 + 12/x^5 + 2```

Create this symbolic function:

```syms x y z
f(x, y, z) = 1/x + y^2 + z^3;```

Compute the Laplacian of this function with respect to the vector [x, y, z]:

`L = laplacian(f, [x y z])`
```L(x, y, z) =
6*z + 2/x^3 + 2```

## Alternatives

The Laplacian of a scalar function or functional expression is the divergence of the gradient of that function or expression:

$\Delta f=\nabla \cdot \left(\nabla f\right)$

Therefore, you can compute the Laplacian using the divergence and gradient functions:

```syms f(x, y)

expand all

### Laplacian of a Scalar Function

The Laplacian of the scalar function or functional expression f with respect to the vector X = (X1,...,Xn) is the sum of the second derivatives of f with respect to X1,...,Xn:

$\Delta f=\sum _{i=1}^{n}\frac{{\partial }^{2}{f}_{i}}{\partial {x}_{i}^{2}}$

### Tips

• If x is a scalar, gradient(f, x) = diff(f, 2, x).