Skip to content

Commit 679c4b0

Browse files
authored
Merge pull request #45 from sikepuri-algorithm/manuscript
Manuscript
2 parents 230ccf8 + 79c8ae0 commit 679c4b0

File tree

4 files changed

+118
-27
lines changed

4 files changed

+118
-27
lines changed

.pre-commit-config.yaml

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,39 +5,23 @@ exclude: (
55
docs/05function/_samples/indent.ipynb
66
)
77
repos:
8-
- repo: https://github.com/pre-commit/pre-commit-hooks
9-
rev: v4.3.0
8+
- repo: https://github.com/datarootsio/databooks
9+
rev: 1.2.3
1010
hooks:
11-
- id: check-added-large-files
12-
- id: check-json
13-
- id: pretty-format-json
14-
args: [--autofix]
15-
- id: check-merge-conflict
16-
- id: check-toml
17-
- id: check-xml
18-
- id: check-yaml
19-
- id: debug-statements
20-
- id: detect-aws-credentials
21-
args: [--allow-missing-credentials]
22-
- id: detect-private-key
23-
- id: end-of-file-fixer
24-
- id: no-commit-to-branch
25-
args: [--branch, main]
26-
- id: requirements-txt-fixer
27-
- id: trailing-whitespace
11+
- id: databooks-meta
2812
- repo: https://github.com/pre-commit/mirrors-prettier
2913
rev: v3.0.0-alpha.3
3014
hooks:
3115
- id: prettier
32-
- repo: https://github.com/pre-commit/mirrors-eslint
33-
rev: v8.26.0
34-
hooks:
35-
- id: eslint
3616
- repo: https://github.com/psf/black
3717
rev: 22.10.0
3818
hooks:
3919
- id: black
4020
- id: black-jupyter
21+
- repo: https://github.com/pre-commit/mirrors-eslint
22+
rev: v8.26.0
23+
hooks:
24+
- id: eslint
4125
- repo: https://github.com/PyCQA/flake8
4226
rev: 5.0.4
4327
hooks:
@@ -55,10 +39,6 @@ repos:
5539
hooks:
5640
- id: markdownlint
5741
args: [-r, ~MD033]
58-
- repo: https://github.com/datarootsio/databooks
59-
rev: 1.2.3
60-
hooks:
61-
- id: databooks-meta
6242
- repo: https://github.com/nbQA-dev/nbQA
6343
rev: 1.5.3
6444
hooks:
@@ -71,3 +51,23 @@ repos:
7151
- id: nbqa-yapf
7252
- id: nbqa-autopep8
7353
- id: nbqa-pydocstyle
54+
- repo: https://github.com/pre-commit/pre-commit-hooks
55+
rev: v4.3.0
56+
hooks:
57+
- id: check-added-large-files
58+
- id: check-json
59+
- id: pretty-format-json
60+
args: [--autofix]
61+
- id: check-merge-conflict
62+
- id: check-toml
63+
- id: check-xml
64+
- id: check-yaml
65+
- id: debug-statements
66+
- id: detect-aws-credentials
67+
args: [--allow-missing-credentials]
68+
- id: detect-private-key
69+
- id: end-of-file-fixer
70+
- id: no-commit-to-branch
71+
args: [--branch, main]
72+
- id: requirements-txt-fixer
73+
- id: trailing-whitespace
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"nbformat": 4,
3+
"nbformat_minor": 2,
4+
"metadata": {},
5+
"cells": [
6+
{
7+
"metadata": {},
8+
"source": [
9+
"import math\n",
10+
"\n",
11+
"math.e"
12+
],
13+
"cell_type": "code",
14+
"outputs": [
15+
{
16+
"output_type": "execute_result",
17+
"data": {
18+
"text/plain": [
19+
"2.718281828459045"
20+
]
21+
},
22+
"metadata": {},
23+
"execution_count": 1
24+
}
25+
],
26+
"execution_count": null
27+
}
28+
]
29+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"nbformat": 4,
3+
"nbformat_minor": 2,
4+
"metadata": {},
5+
"cells": [
6+
{
7+
"metadata": {},
8+
"source": [
9+
"import math\n",
10+
"\n",
11+
"PI = math.pi\n",
12+
"math.sin(PI / 2)"
13+
],
14+
"cell_type": "code",
15+
"outputs": [
16+
{
17+
"output_type": "execute_result",
18+
"data": {
19+
"text/plain": [
20+
"1.0"
21+
]
22+
},
23+
"metadata": {},
24+
"execution_count": 1
25+
}
26+
],
27+
"execution_count": null
28+
}
29+
]
30+
}

docs/python/06library/index.mdx

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,35 @@ import math
3939
| `math.sin(x)` | $\sin x$ を返す。`x` はラジアン | <ViewSource path="_samples/sin.ipynb" /> |
4040
| `math.cos(x)` | $\cos x$ を返す。`x` はラジアン | <ViewSource path="_samples/cos.ipynb" /> |
4141
| `math.tan(x)` | $\tan x$ を返す。`x` はラジアン | <ViewSource path="_samples/tan.ipynb" /> |
42+
43+
`math` ライブラリには、この他にもさまざまな使い方があるので調べてみましょう。
44+
45+
`math` ライブラリ以外のライブラリについても調べてみましょう。
46+
47+
:::note 調べ方
48+
まず、やりたいことを[Google](https://www.google.co.jp/)[Yahoo Japan!](https://www.yahoo.co.jp/)[Bing](https://www.bing.com/?cc=jp)などの検索エンジンを用いて調べてみましょう。Python に関する情報は豊富にあるので、きっと見つかるはずです。そこで、どのような方法を使えば良いのかわかったら、公式のドキュメントを読んで詳しい使い方を学びましょう。インターネットには古い情報や間違った情報も多くあるので、公式ドキュメントを読むとよく分かることも多いです。
49+
50+
Python の公式ドキュメントは、<https://docs.python.org/ja/3/>を見ると良いでしょう。
51+
:::
52+
53+
### 練習問題 1
54+
55+
`math` ライブラリを使用して、$\sin \frac{\pi}{2}$ の値を計算してみましょう。
56+
57+
<Answer>
58+
<ViewSource path="_samples/sin_pi.ipynb" />
59+
</Answer>
60+
61+
### 練習問題 2
62+
63+
`math` ライブラリを使用して、自然対数の底 $e$ の値を出力してみましょう。
64+
65+
ヒント:この資料の説明だけでは作れません。自分で調べてみましょう。
66+
67+
<Answer>
68+
69+
`math` ライブラリの[公式ドキュメント](https://docs.python.org/ja/3/library/math.html#constants)に使い方が載っています。
70+
`math.e` とすれば、自然対数の底を取得することができます。
71+
72+
<ViewSource path="_samples/e.ipynb" />
73+
</Answer>

0 commit comments

Comments
 (0)