Im Aquarium: Computational Genetics in Python und Mathcad (Teil 1)

Lassen Sie zweifarbige Fische im Aquarium leben.





Beginnen wir mit der Visualisierung. Stellen wir die Anzahl der Fische n = 100 ein und stimmen zu, dass jeder von ihnen eine zufällige Farbe # 0 oder # 1 hat und sich auch an einem zufälligen Punkt (x, y) befindet. Jene. x, y und Farbe sind drei Vektoren der Länge n, und die dritte (z-) Koordinate wird nicht berücksichtigt.





%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)
      
      



Aquarium Modell
Aquarium Modell

Die gleichen drei Vektoren in Mathcad Express können wie folgt generiert werden:





Generieren von Pseudozufallsvektoren in Mathcad Express
Generieren von Pseudozufallsvektoren in Mathcad Express

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)
      
      



:





Modellierung der Farbe von Fischen anhand ihres Genotyps

, , , 25%. Mathcad n=1000 .





Modellierung der Farbe eines Fisches anhand seines Genotyps (Mathcad)
(Mathcad)

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








All Articles