Toggle navigation
Egison
ドキュメント
デモ
オンライン・デモ
ポーカーの役判定
麻雀の上がり判定
双子素数の列挙
ツリー
グラフ
3-SATを解く乱択アルゴリズム
時系列データ解析
オンライン・ツール
オンライン Egison
オンライン・チュートリアル
数式処理
ブログ
コミュニティ
曲面のガウス曲率
May 27 2016
以下のコードは、曲面 `z = f(x, y)` の
ガウス曲率
`K` と
平均曲率
`H` を計算しています。
-- Surface Geometry: First and Second Fundamental Forms def v1 := [|1, 0, ∂/∂ (f x y) x|] def v2 := [|0, 1, ∂/∂ (f x y) y|] assertEqual "tangent vector v1" v1 [| 1, 0, f|1 x y |] assertEqual "tangent vector v2" v2 [| 0, 1, f|2 x y |] def v3 := crossProduct v1 v2 assertEqual "normal vector (cross product)" v3 [| - f|1 x y, - f|2 x y, 1 |] def e3 := v3 / sqrt '(V.* v3 v3) -- Unit normal vector assertEqual "unit normal vector e3" e3 [| - f|1 x y / sqrt ((f|1 x y)^2 + (f|2 x y)^2 + 1), - f|2 x y / sqrt ((f|1 x y)^2 + (f|2 x y)^2 + 1), 1 / sqrt ((f|1 x y)^2 + (f|2 x y)^2 + 1) |] -- First fundamental form coefficients def E := V.* v1 v1 def F := V.* v1 v2 def G := V.* v2 v2 assertEqual "E (first fundamental form)" E (1 + (f|1 x y)^2) assertEqual "F (first fundamental form)" F (f|1 x y * f|2 x y) assertEqual "G (first fundamental form)" G (1 + (f|2 x y)^2) -- Second fundamental form coefficients def L := V.* (∂/∂ v1 x) e3 def M := V.* (∂/∂ v1 y) e3 def N := V.* (∂/∂ v2 y) e3 assertEqual "L (second fundamental form)" L (f|1|1 x y / sqrt ((f|1 x y)^2 + (f|2 x y)^2 + 1)) assertEqual "M (second fundamental form)" M (f|1|2 x y / sqrt ((f|1 x y)^2 + (f|2 x y)^2 + 1)) assertEqual "N (second fundamental form)" N (f|2|2 x y / sqrt ((f|1 x y)^2 + (f|2 x y)^2 + 1)) -- Gaussian curvature K and mean curvature H def K := (L * N - M ^ 2) / '(E * G - F ^ 2) def H := ('E * N + 'G * L + (-2) * F * M) / 2 * '(E * G - F ^ 2) -- The formulas for K and H involve complex expressions with partial derivatives -- They represent the Gaussian and mean curvatures of the surface z = f(x, y)
リンク
Egison 数学ノート目次に戻る
This website in other langauge:
English
,
日本語