{ "cells": [ { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "### 二変数関数 $f(x, y)$ の二階偏導関数\n", "\n" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "### Step 1: 二変数関数の微分\n", "\n", "$$\n", "\\begin{align*}\n", "&f(x,y) \\equiv \\frac{n!}{a! b! (n-a-b)!} x^a (y-x)^b (1-y)^{n-a-b}\\\\\n", "&\\text{want to show}\\Rightarrow\\frac{\\partial f(x, y)}{\\partial x\\partial y}\n", "\\end{align*}\n", "$$\n", "\n", "\n" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "vscode": { "languageId": "python" } }, "outputs": [ { "data": { "text/html": [ "
\"Output\"
" ], "text/plain": [ " a -a - b + n -2 + b\n", " (-1 + b) b x (1 - y) (-x + y) n!\n", "{-(-------------------------------------------------) + \n", " a! b! (-a - b + n)!\n", " \n", " a -1 - a - b + n -1 + b\n", " b (-a - b + n) x (1 - y) (-x + y) n!\n", "> --------------------------------------------------------- + \n", " a! b! (-a - b + n)!\n", " \n", " -1 + a -a - b + n -1 + b\n", " a b x (1 - y) (-x + y) n!\n", "> ----------------------------------------------- - \n", " a! b! (-a - b + n)!\n", " \n", " -1 + a -1 - a - b + n b\n", " a (-a - b + n) x (1 - y) (-x + y) n!\n", "> ---------------------------------------------------------}\n", " a! b! (-a - b + n)!" ] }, "execution_count": 2, "metadata": { "text/html": [], "text/plain": [] }, "output_type": "execute_result" } ], "source": [ "f[x_, y_] := (n!/(a! * b! * (n-a-b)!)) * x^a * (y-x)^b * (1-y)^{n-a-b}\n", "D[f[x, y],x, y]" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "### Step 2: 出力結果のLatex出力\n", "\n", "> やりたいこと\n", "\n", "1. Wolfram Engine出力結果のLaTex形式出力\n", "2. 出力結果をクリップボードへcopy\n" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "vscode": { "languageId": "python" } }, "outputs": [ { "data": { "text/html": [ "
\left\{\frac{a b n! x^{a-1} (y-x)^{b-1} (1-y)^{-a-b+n}}{a! b! (-a-b+n)!}-\frac{a n!\
 
>   x^{a-1} (-a-b+n) (y-x)^b (1-y)^{-a-b+n-1}}{a! b! (-a-b+n)!}-\frac{(b-1) b n! x^a\
 
>   (y-x)^{b-2} (1-y)^{-a-b+n}}{a! b! (-a-b+n)!}+\frac{b n! x^a (-a-b+n) (y-x)^{b-1}\
 
>   (1-y)^{-a-b+n-1}}{a! b! (-a-b+n)!}\right\}
" ], "text/plain": [ "\\left\\{\\frac{a b n! x^{a-1} (y-x)^{b-1} (1-y)^{-a-b+n}}{a! b! (-a-b+n)!}-\\frac{a n!\\\n", " \n", "> x^{a-1} (-a-b+n) (y-x)^b (1-y)^{-a-b+n-1}}{a! b! (-a-b+n)!}-\\frac{(b-1) b n! x^a\\\n", " \n", "> (y-x)^{b-2} (1-y)^{-a-b+n}}{a! b! (-a-b+n)!}+\\frac{b n! x^a (-a-b+n) (y-x)^{b-1}\\\n", " \n", "> (1-y)^{-a-b+n-1}}{a! b! (-a-b+n)!}\\right\\}" ] }, "execution_count": 3, "metadata": { "text/html": [], "text/plain": [] }, "output_type": "execute_result" } ], "source": [ "ToString[TeXForm[D[f[x, y],x, y]]]" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "vscode": { "languageId": "python" } }, "outputs": [], "source": [ "CopyToClipboard[ToString[TeXForm[D[f[x, y],x, y]]]]\n" ] } ], "metadata": { "kernelspec": { "display_name": "Wolfram Language 13.2", "language": "Wolfram Language", "name": "wolframlanguage13.2" }, "language_info": { "codemirror_mode": "mathematica", "file_extension": ".m", "mimetype": "application/vnd.wolfram.m", "name": "Wolfram Language", "pygments_lexer": "mathematica", "version": "12.0" }, "orig_nbformat": 4 }, "nbformat": 4, "nbformat_minor": 2 }