## 2020年5月16日土曜日

### 数学 - Python - 解析学 - 集合論初歩 - 濃度 - 閉区間、半開区間、ベルンシュテインの定理、全単射

1. $\begin{array}{l}g\left(x\right)=\frac{x}{x+1}\\ g\left(x\right)\left(x+1\right)=x\\ x\left(g\left(x\right)-1\right)=-g\left(x\right)\\ x=\frac{g\left(x\right)}{1-g\left(x\right)}\\ {X}_{0}=\left\{1\right\}\\ f\left(1\right)=1\\ \left(g\circ f\right)\left(1\right)=\frac{1}{2}\\ \left(g\circ f\right)\left(\frac{1}{2}\right)=\frac{\frac{1}{2}}{\frac{1}{2}+1}=\frac{1}{1+2}=\frac{1}{3}\\ \left(g\circ f\right)\left(\frac{1}{k}\right)=\frac{\frac{1}{k}}{\frac{1}{k}+1}=\frac{1}{k+1}\end{array}$

よって、 求める全単射 F は

$\begin{array}{l}F:I\to J\\ F:\left[0,1\right]\to \left[0,\infty \right]\\ F\left(x\right)=\left\{\begin{array}{l}f\left(x\right)=x\left(x=\frac{1}{k}\right)\\ {g}^{-1}\left(x\right)=\frac{x}{1-x}\left(x\ne \frac{1}{k}\right)\end{array}\\ k\in \text{ℕ}-\left\{0\right\}\end{array}$

コード

#!/usr/bin/env python3
from sympy import Rational
import matplotlib.pyplot as plt

print('9.')

n = 5

def frange(start, stop, step=0.05):
result = []
while start < stop:
result.append(start)
start += step
return result

def f(x):
if x in [Rational(1, k) for k in range(1, n + 1)]:
return x
return x / (1 - x)

xs = frange(0, Rational(1, n)) + [Rational(1, n)]
for k in range(n - 1):
xs += frange(Rational(1, 5 - k) + 0.001,
Rational(1, 5 - k - 1)) + \
[Rational(1, 5 - k - 1)]

ys = [f(x) for x in xs]
for x, y in zip(xs, ys):
print((x, y))

plt.plot(xs,  ys)
plt.savefig('sample9.png')

% ./sample9.py
9.
(0, 0.0)
(0.05, 0.052631578947368425)
(0.1, 0.11111111111111112)
(0.15000000000000002, 0.17647058823529416)
(1/5, 1/5)
(0.201000000000000, 0.251564455569462)
(1/4, 1/4)
(0.251000000000000, 0.335113484646195)
(0.301000000000000, 0.430615164520744)
(1/3, 1/3)
(0.334333333333333, 0.502253380070105)
(0.384333333333333, 0.624255549539794)
(0.434333333333333, 0.767825574543312)
(0.484333333333333, 0.939237233354880)
(1/2, 1/2)
(0.501000000000000, 1.00400801603206)
(0.551000000000000, 1.22717149220490)
(0.601000000000000, 1.50626566416040)
(0.651000000000000, 1.86532951289398)
(0.701000000000000, 2.34448160535117)
(0.751000000000000, 3.01606425702812)
(0.801000000000000, 4.02512562814071)
(0.851000000000000, 5.71140939597317)
(0.901000000000000, 9.10101010101014)
(0.951000000000000, 19.4081632653063)
(1, 1)
%