Accelerating the pace of engineering and science

# Documentation Center

• Trial Software
• Product Updates

# laplacian

The Laplacian

### Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.

## Syntax

```laplacian(f, [x1, x2, …])
laplacian(f, [x1, x2, …], ogCoord, <c>)
```

## Description

laplacian(f, [ x1, x2, ...]) computes the Laplacian , i.e. div(grad(f)), of the function f = f(x1, x2, …) in the Cartesian coordinates x1, x2, ….

The table linalg::ogCoordTab provides some predefined three-dimensional orthogonal coordinate transformations. Presently, its entries are Cartesian, Cylindrical, Spherical[RightHanded] (or its equivalent Spherical[RightHanded]), EllipticCylindrical, ParabolicCylindrical, RotationParabolic, Torus. See linalg::ogCoordTab for details. For example, the command

laplacian(f(r, Theta, phi), [r, Theta, phi], Spherical[RightHanded])

produces the Laplacian of f in spherical coordinates r, θ, ϕ defined by the transformation

.

Arbitrary orthogonal systems u = (u1, …, un) (in any dimension n) can be used by passing corresponding "scale parameters" as third argument to laplacian. These are defined as follows. Let be Cartesian coordinates, let be an orthognal transformation (i.e., the vectors are orthogonal). The Euclidean lengths of the vectors define the "scales". The list s = [s1, …, sn] can be passed as a third argument to laplacian. For example, the usual two-dimensional polar coordinates x = rcos(ϕ), y = rsin(ϕ) lead to scale factors

.

Thus, laplacian(f(r, phi), [r, phi], [1, r]) produces the Laplacian of f(r, ϕ) in polar coordinates r and ϕ.

laplacian and linalg::laplacian are equivalent.

## Examples

### Example 1

Compute the Laplacian in Cartesian coordinates:

`laplacian(f(x[1], x[2]), [x[1], x[2]])`

`laplacian(x^2*y + c*exp(y) + u*v^2, [x, y, u, v])`

### Example 2

Compute the Laplacian in cylindrical coordinates (r, ϕ, z) given by

.

`expand(laplacian(f(r, phi, z), [r, phi, z], Cylindrical))`

`laplacian(r*cos(phi)*z^3, [r, phi, z], Cylindrical)`

Passing the name Cylindrical of the orthogonal system predefined in linalg::ogCoordTab is the simplest way of using cylindrical coordinates. Alternatively, one may pass appropriate `scale parameters' explicitly. They are stored in linalg::ogCoordTab and can be called in the following way:

`linalg::ogCoordTab[Cylindrical, Scales](r, phi, z)`

`laplacian(r*cos(phi)*z^3, [r, phi, z], %)`

### Example 3

Consider Torus coordinates (r, θ, ϕ) introduced by

.

Here, c is a real constant and 0 ≤ r < c, 0 ≤ θ ≤ 2 π, 0 ≤ ϕ ≤ 2 π is assumed. The "scale parameters" are stored in linalg::ogCoordTab:

`linalg::ogCoordTab[Torus, Scales](r, thet, phi, c)`

The Laplacian of the function f(r, ϕ, z) = r in these coordinates is:

`laplacian(r, [r, thet, phi], %)`

### Example 4

You can introduce new orthogonal systems. For example, consider the orthogonal "6-sphere coordinates" (u, v, w) introduced by

.

This transformation is not stored in linalg::ogCoordTab, hence the corresponding "scale factors" of the metric have to be computed first:

.

With these "scales", the Laplacian can be computed via laplacian:

```s := 1/(u^2 + v^2 + w^2):
factor(laplacian(f(u, v, w), [u, v, w], [s, s, s]))```

Since the Laplacian is the divergence of the gradient, you can compute it in the following way, too:

```divergence(gradient(f(u, v, w), [u, v, w], [s, s, s]),
[u, v, w], [s, s, s])```

`expand(% - %2)`

`delete s:`

## Parameters

 f An arithmetical expression in the variables x1, x2 etc. x1, x2, … ogCoord The name of a three-dimensional orthogonal coordinate system predefined in the table linalg::ogCoordTab, or a list of algebraic expressions representing the scale factors of an orthogonal coordinate system. c The parameter of the coordinate systems EllipticCylindrical and Torus, respectively: an arithmetical expression. The default value is c = 1.

## Return Values

Arithmetical expression.

## Algorithms

Orthogonal coordinates on n are defined by a transformation to Cartesian coordinates on n. The metric tensor associated with the coordinates is given by

.

The Laplacian of a function f is given by the divergence

,

where are the components of the gradient .

## See Also

### MuPAD Functions

Was this topic helpful?