## 2018年10月16日火曜日

### 数学 - Python - 代数学 - 群 - 部分群と生成系(共通部分、公倍数の集合)

1. m と n の公倍数の集合になる。

m、 n がそれぞれ2、3の場合。

$\begin{array}{}2\text{ℤ}=\left\{\dots ,-10,-8,-6,-4,-2,0,2,4,6,8,10,\dots \right\}\\ 3\text{ℤ}=\left\{\dots ,-15,-12,-9,-6,-3,0,3,6,9,12,15,\dots \right\}\\ 2\text{ℤ}\cap 3\text{ℤ}=\left\{0,±6,±12,±18,±24,\dots \right\}\end{array}$

コード(Emacs)

Python 3

#!/usr/bin/env python3
from sympy import pprint, FiniteSet
import matplotlib.pyplot as plt
from matplotlib_venn import venn2
import random

print('2.')

for i in range(5):
m = random.randrange(100)
n = random.randrange(100)
print(f'm = {m}, n = {n}')
A = FiniteSet(*[m * i for i in range(-100, 101)])
B = FiniteSet(*[n * i for i in range(-100, 101)])
if i == 0:
venn2(subsets=(A, B), set_labels=(f'{m}Z', f'{n}Z'))
plt.savefig('sample2.svg')
pprint(A & B)
print()



$./sample2.py 2. m = 43, n = 18 {-1548, -774, 0, 774, 1548} m = 6, n = 14 {-588, -546, -504, -462, -420, -378, -336, -294, -252, -210, -168, -126, -84, -42, 0, 42, 84, 126, 168, 210, 252, 294, 336, 378, 420, 462, 504, 546, 588} m = 80, n = 74 {-5920, -2960, 0, 2960, 5920} m = 57, n = 13 {-741, 0, 741} m = 28, n = 3 {-252, -168, -84, 0, 84, 168, 252}$