Previous Up Next

6.21.2 Laplacian: laplacian

Recall, the Laplacian of a function F of n variables x1,…,xn is

∇2(F)=
∂2 F
∂ x12
+
∂2 F
∂ x22
+ ⋯+
∂2 F
∂ xn2
 

Also, the n× n discrete Laplacian matrix (also called the second difference matrix) is the n × n tridiagonal matrix with 2s on the main diagonal, −1s just above and below the main diagonal;

⎛
⎜
⎜
⎜
⎜
⎜
⎝
2−10⋯0
−12−1⋯0
⋮⋮⋮⋮0
0⋯−12−1
0⋯0−12
⎞
⎟
⎟
⎟
⎟
⎟
⎠

If L is the n× n discrete Laplacian matrix and Y is an n × 1 column vector whose kth coordinate is yi = y(a + kΔ x) for a twice differential function y, then the kth coordinate of L Y will be −y(a + (k−1)Δ x) + 2 y(a + kΔ x) − y (a + (k−1)Δ x) (implicitly assuming that y(a) = y(a + (N+1)Δ x) = 0), which approximates y″(a + kΔ x). So L Y is approximately −Δ x2 Y″, where Y″ is the n × 1 column vector whose kth coordinate is y″(a + kδ x).

The laplacian command can compute the Laplacian operator or the discrete Laplacian matrix.

To compute the Laplacian operator:


Example
Find the Laplacian of F(x,y,z)=2x2y−xz3.
Input:

laplacian(2*x^2*y-x*z^3,[x,y,z])

Output:

−6 x z+4 y

To compute the discrete Laplacian matrix:


Examples.


Previous Up Next