学習環境
- Surface
- Windows 10 Pro (OS)
- Nebo(Windows アプリ)
- iPad
- MyScript Nebo - MyScript(iPad アプリ(iOS))
- 参考書籍
解析入門(中) (松坂和夫 数学入門シリーズ 5) (松坂 和夫(著)、岩波書店)の第12章(距離空間の世界)、12.1(位相の基礎的諸概念)、問題10の解答を求めてみる。
(証明終)
コード
#!/usr/bin/env python3
from unittest import TestCase, main
import random
from sympy import Interval
print('10.')
class Test(TestCase):
def test_boundary_intersect_closure_union(self):
for _ in range(10):
a0, a1 = [random.randrange(-10, 11) for _ in range(2)]
A = Interval(a0, a1)
self.assertEqual(
A.closure.interior.closure.interior,
A.closure.interior,
)
self.assertEqual(
A.interior.closure.interior.closure,
A.interior.closure,
)
A = Interval(a0, a1)
self.assertEqual(
A.closure.interior.closure.interior,
A.closure.interior,
)
self.assertEqual(
A.interior.closure.interior.closure,
A.interior.closure,
)
A = Interval(a0, a1)
self.assertEqual(
A.closure.interior.closure.interior,
A.closure.interior,
)
self.assertEqual(
A.interior.closure.interior.closure,
A.interior.closure,
)
A = Interval(a0, a1)
self.assertEqual(
A.closure.interior.closure.interior,
A.closure.interior,
)
self.assertEqual(
A.interior.closure.interior.closure,
A.interior.closure,
)
A = Interval.Lopen(a0, a1)
self.assertEqual(
A.closure.interior.closure.interior,
A.closure.interior,
)
self.assertEqual(
A.interior.closure.interior.closure,
A.interior.closure,
)
A = Interval.Lopen(a0, a1)
self.assertEqual(
A.closure.interior.closure.interior,
A.closure.interior,
)
self.assertEqual(
A.interior.closure.interior.closure,
A.interior.closure,
)
A = Interval.Lopen(a0, a1)
self.assertEqual(
A.closure.interior.closure.interior,
A.closure.interior,
)
self.assertEqual(
A.interior.closure.interior.closure,
A.interior.closure,
)
A = Interval.Ropen(a0, a1)
self.assertEqual(
A.closure.interior.closure.interior,
A.closure.interior,
)
self.assertEqual(
A.interior.closure.interior.closure,
A.interior.closure,
)
A = Interval.Ropen(a0, a1)
self.assertEqual(
A.closure.interior.closure.interior,
A.closure.interior,
)
self.assertEqual(
A.interior.closure.interior.closure,
A.interior.closure,
)
A = Interval.open(a0, a1)
self.assertEqual(
A.closure.interior.closure.interior,
A.closure.interior,
)
self.assertEqual(
A.interior.closure.interior.closure,
A.interior.closure,
)
if __name__ == "__main__":
main()
入出力結果(Zsh、PowerShell、Terminal、Jupyter(IPython))
% ./sample10.py -v
10.
test_boundary_intersect_closure_union (__main__.Test) ... ok
----------------------------------------------------------------------
Ran 1 test in 1.508s
OK
%
0 コメント:
コメントを投稿