Documentation |
The Laplacian
This functionality does not run in MATLAB.
laplacian(f, [x_{1}, x_{2}, …]) laplacian(f, [x_{1}, x_{2}, …], ogCoord, <c>)
laplacian(f, [ x_{1}, x_{2}, ...]) computes the Laplacian , i.e. div(grad(f)), of the function f = f(x_{1}, x_{2}, …) in the Cartesian coordinates x_{1}, x_{2}, ….
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 = (u_{1}, …, u_{n}) (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 = [s_{1}, …, s_{n}] can be passed as a third argument to laplacian. For example, the usual two-dimensional polar coordinates x = r cos(ϕ), y = r sin(ϕ) lead to scale factors
.
Thus, laplacian(f(r, phi), [r, phi], [1, r]) produces the Laplacian of f(r, ϕ) in polar coordinates r and ϕ.
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])
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], %)
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], %)
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:
f |
An arithmetical expression in the variables x_{1}, x_{2} etc. |
x_{1}, x_{2}, … | |
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. |
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 .