2017年9月25日月曜日

学習環境

集合・位相入門 (松坂 和夫(著)、岩波書店)の第1章(集合と写像)、2(集合間の演算)、問題8、9を取り組んでみる。


    1. AΔϕ =( A ϕ c )( A c ϕ ) =Aϕ =A

    2. AΔX =( A X c )( A c X ) =( Aϕ )( A c X ) =ϕ A c = A c

    3. AΔA =( A A c )( A c A ) =ϕϕ =ϕ

    4. AΔ A c =( AA )( A c A c ) =A A c =X

  1. A 1 Δ A 2 = B 1 Δ B 2 ( A 1 Δ A 2 )Δ B 2 =( B 1 Δ B 2 )Δ B 2 A 1 Δ( ( A 1 Δ A 2 )Δ B 2 )= A 1 Δ( ( B 1 Δ B 2 )Δ B 2 ) A 1 Δ( ( A 1 Δ A 2 )Δ B 2 ) =( A 1 Δ( A 1 Δ A 2 ) )Δ B 2 =( ( A 1 Δ A 1 )Δ A 2 )Δ B 2 =( ϕΔ A 2 )Δ B 2 = A 2 Δ B 2 A 1 Δ( ( B 1 Δ B 2 )Δ B 2 ) = A 1 Δ( B 1 Δ( B 2 Δ B 2 ) ) = A 1 Δ( B 1 Δϕ ) = A 1 Δ B 1 A 1 Δ B 1 = A 2 Δ B 2

コード(Emacs)

Python 3

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from matplotlib_venn import venn3
import matplotlib.pyplot as plt

from sympy import pprint, FiniteSet, Interval

print('8.')

phi = FiniteSet()
X = FiniteSet(*range(7))
A = FiniteSet(*range(5))
B = FiniteSet(*range(1, 6))
XS = [(A, phi, A),
      (A, X, A.complement(X)),
      (A, A, phi),
      (A, A.complement(X), X)]

for X0 in [phi, X, A, B]:
    pprint(X0)

for i, (A0, B0, C0) in enumerate(XS):
    print(f'({chr(ord("a") + i)})')
    for X0 in [A0, B0, A0.symmetric_difference(B0), C0]:
        pprint(X0)
    print(A0.symmetric_difference(B0) == C0)
    print()

venn3(subsets=(X, A, B), set_labels=('X', 'A', 'C'))
plt.savefig('sample8.svg')

入出力結果(Terminal, Jupyter(IPython))

$ ./sample8.py
8.
∅
{0, 1, 2, 3, 4, 5, 6}
{0, 1, 2, 3, 4}
{1, 2, 3, 4, 5}
(a)
{0, 1, 2, 3, 4}
∅
{0, 1, 2, 3, 4}
{0, 1, 2, 3, 4}
True

(b)
{0, 1, 2, 3, 4}
{0, 1, 2, 3, 4, 5, 6}
{5, 6}
{5, 6}
True

(c)
{0, 1, 2, 3, 4}
{0, 1, 2, 3, 4}
∅
∅
True

(d)
{0, 1, 2, 3, 4}
{5, 6}
{0, 1, 2, 3, 4, 5, 6}
{0, 1, 2, 3, 4, 5, 6}
True

$

0 コメント:

コメントを投稿