水族館で:PythonとMathcadの計算遺伝学(パート1)

2色の魚を水族館に住まわせましょう。





視覚化から始めましょう。魚の数n = 100を設定し、それぞれがランダムな色#0または#1を持ち、ランダムな点(x、y)にも配置されていることに同意しましょう。それら。x、y、およびcolorは長さnの3つのベクトルであり、3番目の(z-)座標は考慮されません。





%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
n = 100
x, y = np.random.rand(n), np.random.rand(n)
color = np.random.randint(0, 2, n)
plt.scatter(x, y, c=color)
      
      



水族館モデル
水族館モデル

Mathcad Expressの同じ3つのベクトルは、次のように生成できます。





MathcadExpressでの疑似ランダムベクトルの生成
MathcadExpressでの疑似ランダムベクトルの生成

x,y (0, 1), color — , , , . Mathcad 47 №1 100-47=53 .





: 0 1?





, , . , , , , "" , , , .





, , . , . , , (0 1) (" "). ( ) , , , (, -) .





? , , ( , ). (, ). =0, =1.





, .. :





  • 00





  • ( , ) 01





  • 11





, , — . .. , (0) , (1) — .





, i- , — , , . , 00, 10, 01 11. , — .





n = 3
Aa = np.zeros((n,2))
color = np.zeros(n)
for i in range(n):
  Aa[i,0] = np.random.randint(0, 2, 1)
  Aa[i,1] = np.random.randint(0, 2, 1)
  color[i] = Aa[i,0] * Aa[i,1]
print (Aa)
print (color)
      
      



:





遺伝子型による魚の色のモデリング

, , , 25%. Mathcad n=1000 .





遺伝子型による魚の色のモデリング(Mathcad)
(Mathcad)

YouTube , .. , — . , , , Python, Mathcad , . .








All Articles