Created
August 15, 2018 13:27
-
-
Save regonn/f88da8dafc8b7a2679f956ea6d2e3d7d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"### $$y=\\log_{a}(x)$$ の逆関数を説明できる\n", | |
"- No: 2\n", | |
"- Sub No: 2\n", | |
"- 難易度: ★\n", | |
"- カテゴリ名: 統計数理基礎\n", | |
"- 必須スキル: ◯\n", | |
"\n", | |
"\n", | |
"\n", | |
"### 逆関数\n", | |
"- $$y=f(x)$$ で表される式を $$x=g(y)$$ にしたもの\n", | |
"- $$f(x)$$ 逆関数は $$f^{-1}(x)$$ と書く\n", | |
"- $$y=f(x)$$ なら $$x=f^{-1}(y)$$\n", | |
"- 直線 $$y=x$$ に関して対称になる\n", | |
"\n", | |
"\n", | |
"### 逆関数の例\n", | |
"\n", | |
"$$f(x)=3x+1$$\n", | |
"\n", | |
"$$f^{-1}(x)=\\frac{x-1}{3}$$\n", | |
"\n", | |
"$$f(2)=7,f^{-1}(7)=2$$\n", | |
"\n", | |
"\n", | |
"\n", | |
"### log の逆関数\n", | |
"\n", | |
"$$f(x)=log_{a}(x)$$\n", | |
"\n", | |
"$$f^{-1}(x)=a^{x}$$\n", | |
"\n", | |
"※ a の部分は 底(てい) と呼ばれ、1以外の正の実数\n", | |
"\n", | |
"\n", | |
"\n", | |
"### Juliaで関数をプロットしてみる\n", | |
"\n", | |
"```julia\n", | |
"f(x) = log(x) # 底(a) が ネイピア数e(2.7182...) の場合\n", | |
"g(x) = exp(x) # e^x\n", | |
"```\n", | |
"\n", | |
"\n", | |
"```julia\n", | |
"using Gadfly # グラフの描画\n", | |
"\n", | |
"# 描画用に範囲を決める\n", | |
"log_range = 0.007:0.001:5.0 # 0.007から0.001刻みで5.0までの範囲を表す\n", | |
"exp_range = -5.0:0.001:1.6\n", | |
"x_range = -5.0:0.001:5.0\n", | |
"\n", | |
"# plotする\n", | |
"Gadfly.plot(\n", | |
" layer(x = log_range, y = f(log_range), Geom.line, Theme(default_color=color(\"red\")) ),\n", | |
" layer(x = exp_range, y = g(exp_range), Geom.line, Theme(default_color=color(\"blue\")) ),\n", | |
" layer(x = x_range, y = x_range, Geom.line, Theme(default_color=color(\"black\")) ),\n", | |
" Guide.manual_color_key(\"式\",[\"log\", \"exp\"], [\"red\", \"blue\"])\n", | |
")\n", | |
"```\n", | |
"\n", | |
"\n", | |
"![](/images/log-exp.jpg)\n", | |
"\n", | |
"\n", | |
"### 数値確認\n", | |
"\n", | |
"```julia\n", | |
"f(1.0) # => 0.0\n", | |
"g(0.0) # => 1.0\n", | |
"f(0.1) # => -2.3025850929940455\n", | |
"g(-2.3025850929940455) # => 0.10000000000000002\n", | |
"```" | |
] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3", | |
"language": "python", | |
"name": "python3" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.6.5" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment