From 7cabc8e80bccec96839325291fa15b32529f5aff Mon Sep 17 00:00:00 2001
From: chvmvd <chvmvd@users.noreply.github.com>
Date: Sun, 23 Oct 2022 13:45:00 +0900
Subject: [PATCH 1/8] =?UTF-8?q?=E3=82=A8=E3=83=A9=E3=83=BC=E3=82=92output?=
 =?UTF-8?q?=E3=81=AB=E5=87=BA=E3=81=9B=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?=
 =?UTF-8?q?=E3=81=97=E3=81=9F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/components/ViewSource/ViewSource.tsx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/components/ViewSource/ViewSource.tsx b/src/components/ViewSource/ViewSource.tsx
index f2d72c7be..8f2ec9261 100644
--- a/src/components/ViewSource/ViewSource.tsx
+++ b/src/components/ViewSource/ViewSource.tsx
@@ -37,7 +37,7 @@ export default function ViewSource({ path, nooutput = false }) {
           .map((cell) =>
             cell.outputs.map((output) =>
               (output.text === undefined
-                ? output.data["text/plain"]
+                ? output.traceback===undefined ? output.data["text/plain"] : output.traceback
                 : output.text
               ).join("")
             )

From 40dbbd9e3e063befa897d22b391174f46268de73 Mon Sep 17 00:00:00 2001
From: chvmvd <chvmvd@users.noreply.github.com>
Date: Sun, 23 Oct 2022 13:59:23 +0900
Subject: [PATCH 2/8] =?UTF-8?q?=E3=82=A8=E3=83=A9=E3=83=BC=E3=81=AE?=
 =?UTF-8?q?=E4=BE=8B=E3=81=AE=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB=E3=82=92?=
 =?UTF-8?q?pre-commit=E3=81=8B=E3=82=89=E5=A4=96=E3=81=97=E3=81=9F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .pre-commit-config.yaml | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index f74306aa1..081f7a782 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -1,6 +1,9 @@
 # See https://pre-commit.com for more information
 # See https://pre-commit.com/hooks.html for more hooks
-exclude: static/img/
+exclude: (
+  static/img/
+  docs/05function/_samples/indent.ipynb
+  )
 repos:
   - repo: https://github.com/pre-commit/pre-commit-hooks
     rev: v4.3.0

From 12711d66e20e8ac1f9c6d20d86f8e8593fe28eea Mon Sep 17 00:00:00 2001
From: chvmvd <chvmvd@users.noreply.github.com>
Date: Sun, 23 Oct 2022 14:02:13 +0900
Subject: [PATCH 3/8] =?UTF-8?q?pre-commit=E3=82=92=E4=B8=80=E9=83=A8?=
 =?UTF-8?q?=E5=89=8A=E9=99=A4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .pre-commit-config.yaml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 081f7a782..97f393a4e 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -62,12 +62,12 @@ repos:
   - repo: https://github.com/nbQA-dev/nbQA
     rev: 1.5.3
     hooks:
-      - id: nbqa-check-ast
+      # - id: nbqa-check-ast
       - id: nbqa-flake8
       - id: nbqa-isort
       - id: nbqa-mypy
-      - id: nbqa-pylint
+      # - id: nbqa-pylint
       - id: nbqa-pyupgrade
-      - id: nbqa-yapf
+      # - id: nbqa-yapf
       - id: nbqa-autopep8
-      - id: nbqa-pydocstyle
+      # - id: nbqa-pydocstyle

From 1d1f98322169a845ccac37a3340dab00a2f449c2 Mon Sep 17 00:00:00 2001
From: chvmvd <chvmvd@users.noreply.github.com>
Date: Sun, 23 Oct 2022 14:06:15 +0900
Subject: [PATCH 4/8] =?UTF-8?q?=E9=96=A2=E6=95=B0=E3=81=AE=E9=A0=85?=
 =?UTF-8?q?=E3=82=92=E5=9F=B7=E7=AD=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../05function/_samples/gravitation.ipynb     | 34 +++++++
 docs/python/05function/_samples/hello.ipynb   | 28 ++++++
 docs/python/05function/_samples/indent.ipynb  | 28 ++++++
 .../_samples/introduce_language.ipynb         | 28 ++++++
 .../_samples/introduce_language2.ipynb        | 28 ++++++
 .../05function/_samples/introduce_self.ipynb  | 28 ++++++
 .../05function/_samples/introduce_self2.ipynb | 28 ++++++
 .../05function/_samples/introduce_self3.ipynb | 28 ++++++
 .../05function/_samples/introduce_self4.ipynb | 28 ++++++
 docs/python/05function/_samples/x2.ipynb      | 27 ++++++
 .../05function/_samples/x2_function.ipynb     | 31 +++++++
 docs/python/05function/index.mdx              | 93 +++++++++++++++++++
 12 files changed, 409 insertions(+)
 create mode 100644 docs/python/05function/_samples/gravitation.ipynb
 create mode 100644 docs/python/05function/_samples/hello.ipynb
 create mode 100644 docs/python/05function/_samples/indent.ipynb
 create mode 100644 docs/python/05function/_samples/introduce_language.ipynb
 create mode 100644 docs/python/05function/_samples/introduce_language2.ipynb
 create mode 100644 docs/python/05function/_samples/introduce_self.ipynb
 create mode 100644 docs/python/05function/_samples/introduce_self2.ipynb
 create mode 100644 docs/python/05function/_samples/introduce_self3.ipynb
 create mode 100644 docs/python/05function/_samples/introduce_self4.ipynb
 create mode 100644 docs/python/05function/_samples/x2.ipynb
 create mode 100644 docs/python/05function/_samples/x2_function.ipynb
 create mode 100644 docs/python/05function/index.mdx

diff --git a/docs/python/05function/_samples/gravitation.ipynb b/docs/python/05function/_samples/gravitation.ipynb
new file mode 100644
index 000000000..dbd52365e
--- /dev/null
+++ b/docs/python/05function/_samples/gravitation.ipynb
@@ -0,0 +1,34 @@
+{
+  "nbformat": 4,
+  "nbformat_minor": 2,
+  "metadata": {},
+  "cells": [
+    {
+      "metadata": {},
+      "source": [
+        "G = 6.7 * 10 ** (-11)\n",
+        "\n",
+        "\n",
+        "def F(r, M, m):\n",
+        "    return G * M * m / r**2\n",
+        "\n",
+        "\n",
+        "F(2, 60, 20)"
+      ],
+      "cell_type": "code",
+      "outputs": [
+        {
+          "output_type": "execute_result",
+          "data": {
+            "text/plain": [
+              "2.0099999999999998e-08"
+            ]
+          },
+          "metadata": {},
+          "execution_count": 2
+        }
+      ],
+      "execution_count": null
+    }
+  ]
+}
diff --git a/docs/python/05function/_samples/hello.ipynb b/docs/python/05function/_samples/hello.ipynb
new file mode 100644
index 000000000..1c9f41c91
--- /dev/null
+++ b/docs/python/05function/_samples/hello.ipynb
@@ -0,0 +1,28 @@
+{
+  "nbformat": 4,
+  "nbformat_minor": 2,
+  "metadata": {},
+  "cells": [
+    {
+      "metadata": {},
+      "source": [
+        "def hello():\n",
+        "    print(\"Hello!\")\n",
+        "\n",
+        "\n",
+        "hello()"
+      ],
+      "cell_type": "code",
+      "outputs": [
+        {
+          "output_type": "stream",
+          "name": "stdout",
+          "text": [
+            "Hello!\n"
+          ]
+        }
+      ],
+      "execution_count": null
+    }
+  ]
+}
diff --git a/docs/python/05function/_samples/indent.ipynb b/docs/python/05function/_samples/indent.ipynb
new file mode 100644
index 000000000..984654f66
--- /dev/null
+++ b/docs/python/05function/_samples/indent.ipynb
@@ -0,0 +1,28 @@
+{
+  "nbformat": 4,
+  "nbformat_minor": 2,
+  "metadata": {},
+  "cells": [
+    {
+      "metadata": {},
+      "source": [
+        "def f(x):\n",
+        "return x**2\n",
+        "\n",
+        "f(2)+f(3)"
+      ],
+      "cell_type": "code",
+      "outputs": [
+        {
+          "output_type": "error",
+          "ename": "IndentationError",
+          "evalue": "expected an indented block after function definition on line 1 (3556709620.py, line 2)",
+          "traceback": [
+            "\u001b[0;36m  Cell \u001b[0;32mIn [1], line 2\u001b[0;36m\u001b[0m\n\u001b[0;31m    return x**2\u001b[0m\n\u001b[0m    ^\u001b[0m\n\u001b[0;31mIndentationError\u001b[0m\u001b[0;31m:\u001b[0m expected an indented block after function definition on line 1\n"
+          ]
+        }
+      ],
+      "execution_count": null
+    }
+  ]
+}
diff --git a/docs/python/05function/_samples/introduce_language.ipynb b/docs/python/05function/_samples/introduce_language.ipynb
new file mode 100644
index 000000000..ba5aece59
--- /dev/null
+++ b/docs/python/05function/_samples/introduce_language.ipynb
@@ -0,0 +1,28 @@
+{
+  "nbformat": 4,
+  "nbformat_minor": 2,
+  "metadata": {},
+  "cells": [
+    {
+      "metadata": {},
+      "source": [
+        "def introduce_self(name, language):\n",
+        "    print(f\"\u79c1\u306e\u540d\u524d\u306f\u3001{name}\u3067\u3059\u3002{language}\u9078\u629e\u3067\u3059\u3002\")\n",
+        "\n",
+        "\n",
+        "introduce_self(\"\u6771\u5927\u592a\u90ce\", \"\u4e2d\u56fd\u8a9e\")"
+      ],
+      "cell_type": "code",
+      "outputs": [
+        {
+          "output_type": "stream",
+          "name": "stdout",
+          "text": [
+            "\u79c1\u306e\u540d\u524d\u306f\u3001\u6771\u5927\u592a\u90ce\u3067\u3059\u3002\u4e2d\u56fd\u8a9e\u9078\u629e\u3067\u3059\u3002\n"
+          ]
+        }
+      ],
+      "execution_count": null
+    }
+  ]
+}
diff --git a/docs/python/05function/_samples/introduce_language2.ipynb b/docs/python/05function/_samples/introduce_language2.ipynb
new file mode 100644
index 000000000..ee3c24bfa
--- /dev/null
+++ b/docs/python/05function/_samples/introduce_language2.ipynb
@@ -0,0 +1,28 @@
+{
+  "nbformat": 4,
+  "nbformat_minor": 2,
+  "metadata": {},
+  "cells": [
+    {
+      "metadata": {},
+      "source": [
+        "def introduce_self(name, language):\n",
+        "    print(\"\u79c1\u306e\u540d\u524d\u306f\u3001\" + name + \"\u3067\u3059\u3002\" + language + \"\u9078\u629e\u3067\u3059\u3002\")\n",
+        "\n",
+        "\n",
+        "introduce_self(\"\u6771\u5927\u592a\u90ce\", \"\u4e2d\u56fd\u8a9e\")"
+      ],
+      "cell_type": "code",
+      "outputs": [
+        {
+          "output_type": "stream",
+          "name": "stdout",
+          "text": [
+            "\u79c1\u306e\u540d\u524d\u306f\u3001\u6771\u5927\u592a\u90ce\u3067\u3059\u3002\u4e2d\u56fd\u8a9e\u9078\u629e\u3067\u3059\u3002\n"
+          ]
+        }
+      ],
+      "execution_count": null
+    }
+  ]
+}
diff --git a/docs/python/05function/_samples/introduce_self.ipynb b/docs/python/05function/_samples/introduce_self.ipynb
new file mode 100644
index 000000000..5bc9dc15a
--- /dev/null
+++ b/docs/python/05function/_samples/introduce_self.ipynb
@@ -0,0 +1,28 @@
+{
+  "nbformat": 4,
+  "nbformat_minor": 2,
+  "metadata": {},
+  "cells": [
+    {
+      "metadata": {},
+      "source": [
+        "def introduce_self(name):\n",
+        "    print(f\"\u79c1\u306e\u540d\u524d\u306f\u3001{name}\u3067\u3059\u3002\")\n",
+        "\n",
+        "\n",
+        "introduce_self(\"\u7530\u4e2d\")"
+      ],
+      "cell_type": "code",
+      "outputs": [
+        {
+          "output_type": "stream",
+          "name": "stdout",
+          "text": [
+            "\u79c1\u306e\u540d\u524d\u306f\u3001\u7530\u4e2d\u3067\u3059\u3002\n"
+          ]
+        }
+      ],
+      "execution_count": null
+    }
+  ]
+}
diff --git a/docs/python/05function/_samples/introduce_self2.ipynb b/docs/python/05function/_samples/introduce_self2.ipynb
new file mode 100644
index 000000000..d5be41f8b
--- /dev/null
+++ b/docs/python/05function/_samples/introduce_self2.ipynb
@@ -0,0 +1,28 @@
+{
+  "nbformat": 4,
+  "nbformat_minor": 2,
+  "metadata": {},
+  "cells": [
+    {
+      "metadata": {},
+      "source": [
+        "def introduce_self(name):\n",
+        "    print(\"\u79c1\u306e\u540d\u524d\u306f\u3001\" + name + \"\u3067\u3059\u3002\")\n",
+        "\n",
+        "\n",
+        "introduce_self(\"\u7530\u4e2d\")"
+      ],
+      "cell_type": "code",
+      "outputs": [
+        {
+          "output_type": "stream",
+          "name": "stdout",
+          "text": [
+            "\u79c1\u306e\u540d\u524d\u306f\u3001\u7530\u4e2d\u3067\u3059\u3002\n"
+          ]
+        }
+      ],
+      "execution_count": null
+    }
+  ]
+}
diff --git a/docs/python/05function/_samples/introduce_self3.ipynb b/docs/python/05function/_samples/introduce_self3.ipynb
new file mode 100644
index 000000000..d3af26086
--- /dev/null
+++ b/docs/python/05function/_samples/introduce_self3.ipynb
@@ -0,0 +1,28 @@
+{
+  "nbformat": 4,
+  "nbformat_minor": 2,
+  "metadata": {},
+  "cells": [
+    {
+      "metadata": {},
+      "source": [
+        "def introduce_self(name):\n",
+        "    return f\"\u79c1\u306e\u540d\u524d\u306f\u3001{name}\u3067\u3059\u3002\"\n",
+        "\n",
+        "\n",
+        "print(introduce_self(\"\u5c0f\u6797\"))"
+      ],
+      "cell_type": "code",
+      "outputs": [
+        {
+          "output_type": "stream",
+          "name": "stdout",
+          "text": [
+            "\u79c1\u306e\u540d\u524d\u306f\u3001\u5c0f\u6797\u3067\u3059\u3002\n"
+          ]
+        }
+      ],
+      "execution_count": null
+    }
+  ]
+}
diff --git a/docs/python/05function/_samples/introduce_self4.ipynb b/docs/python/05function/_samples/introduce_self4.ipynb
new file mode 100644
index 000000000..5bdf6ac92
--- /dev/null
+++ b/docs/python/05function/_samples/introduce_self4.ipynb
@@ -0,0 +1,28 @@
+{
+  "nbformat": 4,
+  "nbformat_minor": 2,
+  "metadata": {},
+  "cells": [
+    {
+      "metadata": {},
+      "source": [
+        "def introduce_self(name):\n",
+        "    return \"\u79c1\u306e\u540d\u524d\u306f\u3001\" + name + \"\u3067\u3059\u3002\"\n",
+        "\n",
+        "\n",
+        "print(introduce_self(\"\u5c0f\u6797\"))"
+      ],
+      "cell_type": "code",
+      "outputs": [
+        {
+          "output_type": "stream",
+          "name": "stdout",
+          "text": [
+            "\u79c1\u306e\u540d\u524d\u306f\u3001\u5c0f\u6797\u3067\u3059\u3002\n"
+          ]
+        }
+      ],
+      "execution_count": null
+    }
+  ]
+}
diff --git a/docs/python/05function/_samples/x2.ipynb b/docs/python/05function/_samples/x2.ipynb
new file mode 100644
index 000000000..4bd48f71f
--- /dev/null
+++ b/docs/python/05function/_samples/x2.ipynb
@@ -0,0 +1,27 @@
+{
+  "nbformat": 4,
+  "nbformat_minor": 2,
+  "metadata": {},
+  "cells": [
+    {
+      "metadata": {},
+      "source": [
+        "2**2 + 3**2"
+      ],
+      "cell_type": "code",
+      "outputs": [
+        {
+          "output_type": "execute_result",
+          "data": {
+            "text/plain": [
+              "13"
+            ]
+          },
+          "metadata": {},
+          "execution_count": 1
+        }
+      ],
+      "execution_count": null
+    }
+  ]
+}
diff --git a/docs/python/05function/_samples/x2_function.ipynb b/docs/python/05function/_samples/x2_function.ipynb
new file mode 100644
index 000000000..4e505b30f
--- /dev/null
+++ b/docs/python/05function/_samples/x2_function.ipynb
@@ -0,0 +1,31 @@
+{
+  "nbformat": 4,
+  "nbformat_minor": 2,
+  "metadata": {},
+  "cells": [
+    {
+      "metadata": {},
+      "source": [
+        "def f(x):\n",
+        "    return x**2\n",
+        "\n",
+        "\n",
+        "f(2) + f(3)"
+      ],
+      "cell_type": "code",
+      "outputs": [
+        {
+          "output_type": "execute_result",
+          "data": {
+            "text/plain": [
+              "13"
+            ]
+          },
+          "metadata": {},
+          "execution_count": 1
+        }
+      ],
+      "execution_count": null
+    }
+  ]
+}
diff --git a/docs/python/05function/index.mdx b/docs/python/05function/index.mdx
new file mode 100644
index 000000000..77648607b
--- /dev/null
+++ b/docs/python/05function/index.mdx
@@ -0,0 +1,93 @@
+---
+sidebar_position: 5
+---
+
+import ViewSource from "@site/src/components/ViewSource/ViewSource";
+import Answer from "@site/src/components/Answer";
+
+# 関数
+
+## 関数
+
+$f(x)=x^2$ としたときの、$f(2)+f(3)$ を求めてみましょう。
+
+<ViewSource path="_samples/x2.ipynb" />
+
+一応できましたが、このようにつくると関数値を求めるときに毎回 $f(x)$ の定義を見て書かなければなりません。今回のように、単純な関数では良いですがもっと複雑な関数では大変です。このようなときに、Pythonでは関数を使用できます。
+
+関数を用いると、次のように簡単にプログラムを書くことができます。
+
+<ViewSource path="_samples/x2_function.ipynb" />
+
+関数は、次のようにしてつくることができます。引数は「ひきすう」と読みます。
+
+```python
+def 関数名(引数):
+    return 戻り値
+```
+
+関数を使用するときは、次のようにするだけです。
+
+```python
+関数名(任意の引数)
+```
+
+:::caution
+Pythonでは、きちんとインデント（字下げ）をしないとエラーが発生してしまいます。
+例えば、先程のプログラムで `return` の前のインデントを忘れると、どこまでが関数の中身であるのかわからなくなり、次のようにエラーが発生してしまいます。
+
+<ViewSource path="_samples/indent.ipynb" />
+:::
+
+プログラムにおける関数は、数学における関数よりも多くのことができます。
+例えば、数学では戻り値は必要ですが、プログラムにおける関数には戻り値は必ずしも必要ありません。そのため、次のようなプログラムをつくることができます。
+
+<ViewSource path="_samples/hello.ipynb" />
+
+このようにプログラムにおいては、一連の処理を実行するときに関数を使うことができます。もちろん、引数を与えると引数に応じた処理をすることができます。
+
+<ViewSource path="_samples/introduce_self.ipynb" />
+
+:::note
+上のプログラムは、下と同じ意味です。下のプログラムでも問題ないのですが、少し格好悪いので、`f-string` を使ってしまいました。気にしないでください。
+
+`+` 記号を使うと、文字列をつなげることができます。
+
+<ViewSource path="_samples/introduce_self2.ipynb" />
+:::
+
+戻り値を使うと、次のようにも表現できます。
+
+<ViewSource path="_samples/introduce_self3.ipynb" />
+
+:::note
+先ほどと同様に `f-string` を使ってしまいました。`f-string` を使わないと、次のようになります。
+
+<ViewSource path="_samples/introduce_self4.ipynb" />
+:::
+
+### 練習問題1
+
+万有引力を求める関数を作って実際に計算してみましょう。
+
+$$
+F=G\frac{Mm}{r^2}
+$$
+
+$G=6.7\times 10^{-11}$、$r=2$、$M=60$、$m=20$ とします。
+
+<Answer>
+  <ViewSource path="_samples/gravitation.ipynb" />
+</Answer>
+
+### 練習問題2
+
+`私の名前は、東大太郎です。中国語選択です。` のように自分の名前と第２外国語を紹介する関数を作ってみましょう。
+
+<Answer>
+<ViewSource path="_samples/introduce_language.ipynb" />
+
+`f-string` を使わないと次のようになります。
+
+<ViewSource path="_samples/introduce_language2.ipynb" />
+</Answer>

From 26f094301f83de3bbf77559aa996874e6e27f57f Mon Sep 17 00:00:00 2001
From: chvmvd <chvmvd@users.noreply.github.com>
Date: Sun, 23 Oct 2022 14:16:02 +0900
Subject: [PATCH 5/8] =?UTF-8?q?pre-commit=E3=82=92=E4=B8=80=E9=83=A8?=
 =?UTF-8?q?=E6=88=BB=E3=81=97=E3=81=9F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .pre-commit-config.yaml | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 97f393a4e..b349cd8c4 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -62,12 +62,12 @@ repos:
   - repo: https://github.com/nbQA-dev/nbQA
     rev: 1.5.3
     hooks:
-      # - id: nbqa-check-ast
+      - id: nbqa-check-ast
       - id: nbqa-flake8
       - id: nbqa-isort
       - id: nbqa-mypy
       # - id: nbqa-pylint
       - id: nbqa-pyupgrade
-      # - id: nbqa-yapf
+      - id: nbqa-yapf
       - id: nbqa-autopep8
-      # - id: nbqa-pydocstyle
+      - id: nbqa-pydocstyle

From 8b8624c5fa6cea1d5c25fb2d0fc2faffa6ef9138 Mon Sep 17 00:00:00 2001
From: chvmvd <chvmvd@users.noreply.github.com>
Date: Sun, 23 Oct 2022 14:46:21 +0900
Subject: [PATCH 6/8] =?UTF-8?q?=E3=83=A9=E3=82=A4=E3=83=96=E3=83=A9?=
 =?UTF-8?q?=E3=83=AA=E3=81=AE=E9=A0=85=E3=82=92=E5=9F=B7=E7=AD=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 docs/python/06library/_samples/ceil.ipynb     | 29 +++++++++++++
 docs/python/06library/_samples/cos.ipynb      | 29 +++++++++++++
 docs/python/06library/_samples/exp.ipynb      | 29 +++++++++++++
 docs/python/06library/_samples/fabs.ipynb     | 29 +++++++++++++
 docs/python/06library/_samples/floor.ipynb    | 29 +++++++++++++
 docs/python/06library/_samples/log.ipynb      | 29 +++++++++++++
 .../06library/_samples/math_example.ipynb     | 29 +++++++++++++
 docs/python/06library/_samples/pi.ipynb       | 29 +++++++++++++
 docs/python/06library/_samples/sin.ipynb      | 29 +++++++++++++
 docs/python/06library/_samples/sqrt.ipynb     | 29 +++++++++++++
 docs/python/06library/_samples/tan.ipynb      | 29 +++++++++++++
 docs/python/06library/index.mdx               | 41 +++++++++++++++++++
 12 files changed, 360 insertions(+)
 create mode 100644 docs/python/06library/_samples/ceil.ipynb
 create mode 100644 docs/python/06library/_samples/cos.ipynb
 create mode 100644 docs/python/06library/_samples/exp.ipynb
 create mode 100644 docs/python/06library/_samples/fabs.ipynb
 create mode 100644 docs/python/06library/_samples/floor.ipynb
 create mode 100644 docs/python/06library/_samples/log.ipynb
 create mode 100644 docs/python/06library/_samples/math_example.ipynb
 create mode 100644 docs/python/06library/_samples/pi.ipynb
 create mode 100644 docs/python/06library/_samples/sin.ipynb
 create mode 100644 docs/python/06library/_samples/sqrt.ipynb
 create mode 100644 docs/python/06library/_samples/tan.ipynb
 create mode 100644 docs/python/06library/index.mdx

diff --git a/docs/python/06library/_samples/ceil.ipynb b/docs/python/06library/_samples/ceil.ipynb
new file mode 100644
index 000000000..21db0a3ee
--- /dev/null
+++ b/docs/python/06library/_samples/ceil.ipynb
@@ -0,0 +1,29 @@
+{
+  "nbformat": 4,
+  "nbformat_minor": 2,
+  "metadata": {},
+  "cells": [
+    {
+      "metadata": {},
+      "source": [
+        "import math\n",
+        "\n",
+        "math.ceil(3.2)"
+      ],
+      "cell_type": "code",
+      "outputs": [
+        {
+          "output_type": "execute_result",
+          "data": {
+            "text/plain": [
+              "4"
+            ]
+          },
+          "metadata": {},
+          "execution_count": 1
+        }
+      ],
+      "execution_count": null
+    }
+  ]
+}
diff --git a/docs/python/06library/_samples/cos.ipynb b/docs/python/06library/_samples/cos.ipynb
new file mode 100644
index 000000000..38777a041
--- /dev/null
+++ b/docs/python/06library/_samples/cos.ipynb
@@ -0,0 +1,29 @@
+{
+  "nbformat": 4,
+  "nbformat_minor": 2,
+  "metadata": {},
+  "cells": [
+    {
+      "metadata": {},
+      "source": [
+        "import math\n",
+        "\n",
+        "math.cos(1)"
+      ],
+      "cell_type": "code",
+      "outputs": [
+        {
+          "output_type": "execute_result",
+          "data": {
+            "text/plain": [
+              "0.5403023058681398"
+            ]
+          },
+          "metadata": {},
+          "execution_count": 1
+        }
+      ],
+      "execution_count": null
+    }
+  ]
+}
diff --git a/docs/python/06library/_samples/exp.ipynb b/docs/python/06library/_samples/exp.ipynb
new file mode 100644
index 000000000..0f2146128
--- /dev/null
+++ b/docs/python/06library/_samples/exp.ipynb
@@ -0,0 +1,29 @@
+{
+  "nbformat": 4,
+  "nbformat_minor": 2,
+  "metadata": {},
+  "cells": [
+    {
+      "metadata": {},
+      "source": [
+        "import math\n",
+        "\n",
+        "math.exp(2)"
+      ],
+      "cell_type": "code",
+      "outputs": [
+        {
+          "output_type": "execute_result",
+          "data": {
+            "text/plain": [
+              "7.38905609893065"
+            ]
+          },
+          "metadata": {},
+          "execution_count": 1
+        }
+      ],
+      "execution_count": null
+    }
+  ]
+}
diff --git a/docs/python/06library/_samples/fabs.ipynb b/docs/python/06library/_samples/fabs.ipynb
new file mode 100644
index 000000000..507527aa3
--- /dev/null
+++ b/docs/python/06library/_samples/fabs.ipynb
@@ -0,0 +1,29 @@
+{
+  "nbformat": 4,
+  "nbformat_minor": 2,
+  "metadata": {},
+  "cells": [
+    {
+      "metadata": {},
+      "source": [
+        "import math\n",
+        "\n",
+        "math.fabs(-4)"
+      ],
+      "cell_type": "code",
+      "outputs": [
+        {
+          "output_type": "execute_result",
+          "data": {
+            "text/plain": [
+              "4.0"
+            ]
+          },
+          "metadata": {},
+          "execution_count": 1
+        }
+      ],
+      "execution_count": null
+    }
+  ]
+}
diff --git a/docs/python/06library/_samples/floor.ipynb b/docs/python/06library/_samples/floor.ipynb
new file mode 100644
index 000000000..f0b4a10a5
--- /dev/null
+++ b/docs/python/06library/_samples/floor.ipynb
@@ -0,0 +1,29 @@
+{
+  "nbformat": 4,
+  "nbformat_minor": 2,
+  "metadata": {},
+  "cells": [
+    {
+      "metadata": {},
+      "source": [
+        "import math\n",
+        "\n",
+        "math.floor(3.2)"
+      ],
+      "cell_type": "code",
+      "outputs": [
+        {
+          "output_type": "execute_result",
+          "data": {
+            "text/plain": [
+              "3"
+            ]
+          },
+          "metadata": {},
+          "execution_count": 2
+        }
+      ],
+      "execution_count": null
+    }
+  ]
+}
diff --git a/docs/python/06library/_samples/log.ipynb b/docs/python/06library/_samples/log.ipynb
new file mode 100644
index 000000000..72dbe9ef0
--- /dev/null
+++ b/docs/python/06library/_samples/log.ipynb
@@ -0,0 +1,29 @@
+{
+  "nbformat": 4,
+  "nbformat_minor": 2,
+  "metadata": {},
+  "cells": [
+    {
+      "metadata": {},
+      "source": [
+        "import math\n",
+        "\n",
+        "math.log(8, 2)"
+      ],
+      "cell_type": "code",
+      "outputs": [
+        {
+          "output_type": "execute_result",
+          "data": {
+            "text/plain": [
+              "3.0"
+            ]
+          },
+          "metadata": {},
+          "execution_count": 2
+        }
+      ],
+      "execution_count": null
+    }
+  ]
+}
diff --git a/docs/python/06library/_samples/math_example.ipynb b/docs/python/06library/_samples/math_example.ipynb
new file mode 100644
index 000000000..3a8c557a7
--- /dev/null
+++ b/docs/python/06library/_samples/math_example.ipynb
@@ -0,0 +1,29 @@
+{
+  "nbformat": 4,
+  "nbformat_minor": 2,
+  "metadata": {},
+  "cells": [
+    {
+      "metadata": {},
+      "source": [
+        "import math\n",
+        "\n",
+        "math.fabs(-2)"
+      ],
+      "cell_type": "code",
+      "outputs": [
+        {
+          "output_type": "execute_result",
+          "data": {
+            "text/plain": [
+              "2.0"
+            ]
+          },
+          "metadata": {},
+          "execution_count": 2
+        }
+      ],
+      "execution_count": null
+    }
+  ]
+}
diff --git a/docs/python/06library/_samples/pi.ipynb b/docs/python/06library/_samples/pi.ipynb
new file mode 100644
index 000000000..246a98362
--- /dev/null
+++ b/docs/python/06library/_samples/pi.ipynb
@@ -0,0 +1,29 @@
+{
+  "nbformat": 4,
+  "nbformat_minor": 2,
+  "metadata": {},
+  "cells": [
+    {
+      "metadata": {},
+      "source": [
+        "import math\n",
+        "\n",
+        "math.pi"
+      ],
+      "cell_type": "code",
+      "outputs": [
+        {
+          "output_type": "execute_result",
+          "data": {
+            "text/plain": [
+              "3.141592653589793"
+            ]
+          },
+          "metadata": {},
+          "execution_count": 4
+        }
+      ],
+      "execution_count": null
+    }
+  ]
+}
diff --git a/docs/python/06library/_samples/sin.ipynb b/docs/python/06library/_samples/sin.ipynb
new file mode 100644
index 000000000..5ae281ff3
--- /dev/null
+++ b/docs/python/06library/_samples/sin.ipynb
@@ -0,0 +1,29 @@
+{
+  "nbformat": 4,
+  "nbformat_minor": 2,
+  "metadata": {},
+  "cells": [
+    {
+      "metadata": {},
+      "source": [
+        "import math\n",
+        "\n",
+        "math.sin(1)"
+      ],
+      "cell_type": "code",
+      "outputs": [
+        {
+          "output_type": "execute_result",
+          "data": {
+            "text/plain": [
+              "0.8414709848078965"
+            ]
+          },
+          "metadata": {},
+          "execution_count": 1
+        }
+      ],
+      "execution_count": null
+    }
+  ]
+}
diff --git a/docs/python/06library/_samples/sqrt.ipynb b/docs/python/06library/_samples/sqrt.ipynb
new file mode 100644
index 000000000..34b6375b1
--- /dev/null
+++ b/docs/python/06library/_samples/sqrt.ipynb
@@ -0,0 +1,29 @@
+{
+  "nbformat": 4,
+  "nbformat_minor": 2,
+  "metadata": {},
+  "cells": [
+    {
+      "metadata": {},
+      "source": [
+        "import math\n",
+        "\n",
+        "math.sqrt(2)"
+      ],
+      "cell_type": "code",
+      "outputs": [
+        {
+          "output_type": "execute_result",
+          "data": {
+            "text/plain": [
+              "1.4142135623730951"
+            ]
+          },
+          "metadata": {},
+          "execution_count": 1
+        }
+      ],
+      "execution_count": null
+    }
+  ]
+}
diff --git a/docs/python/06library/_samples/tan.ipynb b/docs/python/06library/_samples/tan.ipynb
new file mode 100644
index 000000000..621a353e7
--- /dev/null
+++ b/docs/python/06library/_samples/tan.ipynb
@@ -0,0 +1,29 @@
+{
+  "nbformat": 4,
+  "nbformat_minor": 2,
+  "metadata": {},
+  "cells": [
+    {
+      "metadata": {},
+      "source": [
+        "import math\n",
+        "\n",
+        "math.tan(1)"
+      ],
+      "cell_type": "code",
+      "outputs": [
+        {
+          "output_type": "execute_result",
+          "data": {
+            "text/plain": [
+              "1.5574077246549023"
+            ]
+          },
+          "metadata": {},
+          "execution_count": 1
+        }
+      ],
+      "execution_count": null
+    }
+  ]
+}
diff --git a/docs/python/06library/index.mdx b/docs/python/06library/index.mdx
new file mode 100644
index 000000000..9d0c15477
--- /dev/null
+++ b/docs/python/06library/index.mdx
@@ -0,0 +1,41 @@
+---
+sidebar_position: 6
+---
+
+import ViewSource from "@site/src/components/ViewSource/ViewSource";
+import Answer from "@site/src/components/Answer";
+
+# ライブラリ
+
+## ライブラリ
+
+Pythonでは、自分でいちいち関数を作らなくても、すでに用意されている豊富な関数群を使うことができます。（素晴らしい！）
+
+例えば、数学に関する計算をするのに便利な `math` ライブラリがあります。`math` ライブラリを使うと、様々な計算を行うことができます。
+
+例えば、絶対値を求めるには、次のようにします。
+
+<ViewSource path="_samples/fabs.ipynb" />
+
+`math` ライブラリを読み込むために、一行目で、
+
+```python
+import math
+```
+
+と入力します。すると、`math.関数名` のようにして関数を呼び出すことができます。
+
+`math` ライブラリにはこれ以外にも多くの関数が定義されています。その一部を紹介します。
+
+| 関数名             | 説明                                 | 例                                         |
+| ------------------ | ------------------------------------ | ------------------------------------------ |
+| `math.pi`          | $\pi$ を返す。                       | <ViewSource path="_samples/pi.ipynb" />    |
+| `math.ceil(x)`     | `x` の切り上げを返す。               | <ViewSource path="_samples/ceil.ipynb" />  |
+| `math.floor(x)`    | `x` の切り捨てを返す。               | <ViewSource path="_samples/floor.ipynb" /> |
+| `math.fabs(x)`     | `x` の絶対値を返す。                 | <ViewSource path="_samples/fabs.ipynb" />  |
+| `math.sqrt(x)`     | $\sqrt{x}$ を返す。                  | <ViewSource path="_samples/sqrt.ipynb" />  |
+| `math.log(x,base)` | `base` を底とする `x` の対数を返す。 | <ViewSource path="_samples/log.ipynb" />   |
+| `math.exp(x)`      | $e^x$ を返す。                       | <ViewSource path="_samples/exp.ipynb" />   |
+| `math.sin(x)`      | $\sin(x)$ を返す。`x` はラジアン     | <ViewSource path="_samples/sin.ipynb" />   |
+| `math.cos(x)`      | $\cos(x)$ を返す。`x` はラジアン     | <ViewSource path="_samples/cos.ipynb" />   |
+| `math.tan(x)`      | $\tan(x)$ を返す。`x` はラジアン     | <ViewSource path="_samples/tan.ipynb" />   |

From 2fa7c430a7cd345e4c30b835d9d6d25d1c983b52 Mon Sep 17 00:00:00 2001
From: chvmvd <chvmvd@users.noreply.github.com>
Date: Sun, 23 Oct 2022 14:48:06 +0900
Subject: [PATCH 7/8] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=B1=A5=E6=AD=B4?=
 =?UTF-8?q?=E3=82=92=E6=9B=B4=E6=96=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 docs/index.mdx | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/docs/index.mdx b/docs/index.mdx
index e9235740a..f29bafb8b 100644
--- a/docs/index.mdx
+++ b/docs/index.mdx
@@ -27,3 +27,5 @@ Python やアルゴリズムについて簡単にまとめていこうかなと
 10/10 練習問題を追加
 
 10/16 練習問題をさらに追加
+
+10/23 第二週の分を執筆 [ここから](/docs/python/05function/)

From 6a2d0c5a748b64d10100b39bde951dd3f7437db1 Mon Sep 17 00:00:00 2001
From: chvmvd <chvmvd@users.noreply.github.com>
Date: Sun, 23 Oct 2022 05:56:43 +0000
Subject: [PATCH 8/8] Prettified Code!

---
 docs/python/05function/index.mdx         | 8 ++++----
 docs/python/06library/index.mdx          | 2 +-
 src/components/ViewSource/ViewSource.tsx | 4 +++-
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/docs/python/05function/index.mdx b/docs/python/05function/index.mdx
index 77648607b..da8514fd6 100644
--- a/docs/python/05function/index.mdx
+++ b/docs/python/05function/index.mdx
@@ -13,7 +13,7 @@ $f(x)=x^2$ としたときの、$f(2)+f(3)$ を求めてみましょう。
 
 <ViewSource path="_samples/x2.ipynb" />
 
-一応できましたが、このようにつくると関数値を求めるときに毎回 $f(x)$ の定義を見て書かなければなりません。今回のように、単純な関数では良いですがもっと複雑な関数では大変です。このようなときに、Pythonでは関数を使用できます。
+一応できましたが、このようにつくると関数値を求めるときに毎回 $f(x)$ の定義を見て書かなければなりません。今回のように、単純な関数では良いですがもっと複雑な関数では大変です。このようなときに、Python では関数を使用できます。
 
 関数を用いると、次のように簡単にプログラムを書くことができます。
 
@@ -33,7 +33,7 @@ def 関数名(引数):
 ```
 
 :::caution
-Pythonでは、きちんとインデント（字下げ）をしないとエラーが発生してしまいます。
+Python では、きちんとインデント（字下げ）をしないとエラーが発生してしまいます。
 例えば、先程のプログラムで `return` の前のインデントを忘れると、どこまでが関数の中身であるのかわからなくなり、次のようにエラーが発生してしまいます。
 
 <ViewSource path="_samples/indent.ipynb" />
@@ -66,7 +66,7 @@ Pythonでは、きちんとインデント（字下げ）をしないとエラ
 <ViewSource path="_samples/introduce_self4.ipynb" />
 :::
 
-### 練習問題1
+### 練習問題 1
 
 万有引力を求める関数を作って実際に計算してみましょう。
 
@@ -80,7 +80,7 @@ $G=6.7\times 10^{-11}$、$r=2$、$M=60$、$m=20$ とします。
   <ViewSource path="_samples/gravitation.ipynb" />
 </Answer>
 
-### 練習問題2
+### 練習問題 2
 
 `私の名前は、東大太郎です。中国語選択です。` のように自分の名前と第２外国語を紹介する関数を作ってみましょう。
 
diff --git a/docs/python/06library/index.mdx b/docs/python/06library/index.mdx
index 9d0c15477..30d19ad67 100644
--- a/docs/python/06library/index.mdx
+++ b/docs/python/06library/index.mdx
@@ -9,7 +9,7 @@ import Answer from "@site/src/components/Answer";
 
 ## ライブラリ
 
-Pythonでは、自分でいちいち関数を作らなくても、すでに用意されている豊富な関数群を使うことができます。（素晴らしい！）
+Python では、自分でいちいち関数を作らなくても、すでに用意されている豊富な関数群を使うことができます。（素晴らしい！）
 
 例えば、数学に関する計算をするのに便利な `math` ライブラリがあります。`math` ライブラリを使うと、様々な計算を行うことができます。
 
diff --git a/src/components/ViewSource/ViewSource.tsx b/src/components/ViewSource/ViewSource.tsx
index 8f2ec9261..0eccb5108 100644
--- a/src/components/ViewSource/ViewSource.tsx
+++ b/src/components/ViewSource/ViewSource.tsx
@@ -37,7 +37,9 @@ export default function ViewSource({ path, nooutput = false }) {
           .map((cell) =>
             cell.outputs.map((output) =>
               (output.text === undefined
-                ? output.traceback===undefined ? output.data["text/plain"] : output.traceback
+                ? output.traceback === undefined
+                  ? output.data["text/plain"]
+                  : output.traceback
                 : output.text
               ).join("")
             )
