学習環境
- Surface 3 (4G LTE)、Surface 3 タイプ カバー、Surface ペン(端末)
- Windows 10 Pro (OS)
- Nebo(Windows アプリ)
- iPad Pro + Apple Pencil
- MyScript Nebo(iPad アプリ)
- 参考書籍
集合・位相入門 (松坂 和夫(著)、岩波書店)の第3章(順序集合、Zorn の補題)、1(順序集合)、A(順序関係).を取り組んでみる。
集合 X を
とする。
この集合のべき集合。
となり、比較可能ではない。
よって包含関係について、全順序ではなく半順序である。
コード(Emacs)
Python 3
#!/usr/bin/env python3
import matplotlib.pyplot as plt
from matplotlib_venn import venn3
from sympy import pprint, symbols, FiniteSet
X = FiniteSet(1, 2)
P = X.powerset()
pprint(P)
print()
for x in P:
for y in P:
pprint(x)
pprint(y)
try:
print(x <= y or y <= x)
except Exception as err:
print(type(err), err)
print()
l = list(P)
pprint(l)
venn3(subsets=l[:3])
plt.savefig('sample0.svg')
入出力結果(Terminal, Jupyter(IPython))
$ ./sample0.py
{∅, {1}, {2}, {1, 2}}
{1}
{1}
True
{1}
{1, 2}
True
{1}
{2}
False
{1}
∅
True
{1, 2}
{1}
True
{1, 2}
{1, 2}
True
{1, 2}
{2}
True
{1, 2}
∅
True
{2}
{1}
False
{2}
{1, 2}
True
{2}
{2}
True
{2}
∅
True
∅
{1}
True
∅
{1, 2}
True
∅
{2}
True
∅
∅
<class 'TypeError'> '<=' not supported between instances of 'EmptySet' and 'EmptySet'
[{1}, {1, 2}, {2}, ∅]
$
0 コメント:
コメントを投稿