{ "cells": [ { "cell_type": "markdown", "id": "1c5b0b35", "metadata": {}, "source": [ "# 偏微分の順序\n", "\n", "十分に滑らかな関数では、混合偏微分の順序を交換できます。ここでは\n", "クレローの定理を次の関数で確かめます。\n", "\n", "$$\n", "f(x,y,z)=\\frac{x^5y^3}{z},\n", "$$\n", "\n", "各変数について1回ずつ、いくつかの異なる順序で偏微分します。\n" ] }, { "cell_type": "markdown", "id": "2a7dd97d", "metadata": {}, "source": [ "## 関数の定義\n", "\n", "型注釈を明示することで、Egisonカーネルが扱う記号計算の領域が\n", "明確になります。\n" ] }, { "cell_type": "code", "execution_count": 1, "id": "e994e177", "metadata": {}, "outputs": [], "source": [ "declare symbol x, y, z : MathValue\n", "\n", "def f (x : MathValue) (y : MathValue) (z : MathValue) : MathValue :=\n", " x^5 * y^3 / z\n" ] }, { "cell_type": "code", "execution_count": 2, "id": "3f7c13e8", "metadata": {}, "outputs": [ { "data": { "text/html": [ "$x^{5} y^{3} z^{-1}$" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "f x y z\n" ] }, { "cell_type": "markdown", "id": "d03c8ce4", "metadata": {}, "source": [ "## 最初の混合偏微分\n", "\n", "$x$、$y$、$z$の順に偏微分すると、次の結果になるはずです。\n", "\n", "$$\n", "\\partial_z\\partial_y\\partial_x f\n", " =-\\frac{15x^4y^2}{z^2}.\n", "$$\n" ] }, { "cell_type": "code", "execution_count": 3, "id": "752fe2ba", "metadata": {}, "outputs": [ { "data": { "text/html": [ "$-15 x^{4} y^{2} z^{-2}$" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "∂/∂ (∂/∂ (∂/∂ (f x y z) x) y) z\n" ] }, { "cell_type": "markdown", "id": "ed4e02d6", "metadata": {}, "source": [ "## 偏微分順序の入れ替え\n", "\n", "同じ計算を$z,y,x$および$y,z,x$の順でも行います。3つの出力が\n", "すべて等しいことは、領域$z\\ne0$におけるクレローの定理を\n", "計算として確かめたものです。\n" ] }, { "cell_type": "code", "execution_count": 4, "id": "ac6a3511", "metadata": {}, "outputs": [ { "data": { "text/html": [ "$-15 x^{4} y^{2} z^{-2}$" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "∂/∂ (∂/∂ (∂/∂ (f x y z) z) y) x\n" ] }, { "cell_type": "code", "execution_count": 5, "id": "b2d326f9", "metadata": {}, "outputs": [ { "data": { "text/html": [ "$-15 x^{4} y^{2} z^{-2}$" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "∂/∂ (∂/∂ (∂/∂ (f x y z) y) z) x\n" ] }, { "cell_type": "markdown", "id": "a49bb78e", "metadata": {}, "source": [ "どの順序からも同じ有理式が得られます。この例から、Egisonでは\n", "偏微分の順序を補助関数名に埋め込むのではなく、微分する変数を\n", "明示したまま計算できることも分かります。\n" ] } ], "metadata": { "kernelspec": { "display_name": "Egison", "language": "egison", "name": "egison" }, "language_info": { "codemirror_mode": "egison", "file_extension": ".egi", "mimetype": "text/x-egison", "name": "egison" } }, "nbformat": 4, "nbformat_minor": 5 }