Wolfram Language

Differential Eigensystems

Compute the Spectrum on a Koch Snowflake

Generate a recursive Koch snowflake.

In[1]:=
Click for copyable input
KochStep[{p1_, p2_}] := With[{q1 = p1 + (p2 - p1)/3, q3 = p1 + 2 (p2 - p1)/3, q2 = (p1 + (p2 - p1)/3) + RotationMatrix[-\[Pi]/3].(p2 - p1)/3}, {p1, q1, q2, q3, p2}]; KochStep[pp : {{_, _} ..}] := Join[Partition[Flatten[Most /@ (KochStep /@ Partition[pp, 2, 1])], 2], {pp[[-1]]}]; vertices = Nest[KochStep, N[{{3 Sqrt[3]/4, 3/4}, {-3 Sqrt[3]/4, 3/4}, {0, -3/2}, {3 Sqrt[3]/4, 3/4}}], 4]; region = Polygon[vertices];

Specify a Laplacian operator.

In[2]:=
Click for copyable input
\[ScriptCapitalL] = -Laplacian[u[x, y], {x, y}];

Specify a Dirichlet boundary condition.

In[3]:=
Click for copyable input
\[ScriptCapitalB] = DirichletCondition[u[x, y] == 0, True];

Compute nine eigenvalues and eigenfunctions of the Laplacian operator.

In[4]:=
Click for copyable input
{vals, funs} = NDEigensystem[{\[ScriptCapitalL], \[ScriptCapitalB]}, u[x, y], {x, y} \[Element] region, 9];

Inspect the eigenvalues.

In[5]:=
Click for copyable input
vals
Out[5]=

Visualize the eigenfunctions.

show complete Wolfram Language input
In[6]:=
Click for copyable input
Grid[Partition[ Table[Plot3D[funs[[i]], {x, y} \[Element] region, PlotLabel -> vals[[i]], MeshFunctions -> {#3 &}, MeshShading -> {Automatic, None}, Mesh -> 10, Background -> None, Boxed -> False, Axes -> None, PlotRange -> All, ColorFunction -> "TemperatureMap"], {i, Length[vals]}], 3], Spacings -> 0]
Out[6]=

Related Examples

de es fr ja ko pt-br ru zh