In the Aquarium: Computational Genetics in Python and Mathcad (Part 1)

Let fish of two colors live in the aquarium.





Let's start with visualization. Let's set the number of fish n = 100 and agree that each of them has a random color # 0 or # 1, and is also located at a random point (x, y). Those. x, y, and color are three vectors of length n, and the third (z-) coordinate is not considered.





%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 model
Aquarium model

The same three vectors in Mathcad Express can be generated as follows:





Generating pseudo-random vectors in Mathcad Express
Generating pseudo-random vectors 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)
      
      



:





Modeling the color of fish through its genotype

, , , 25%. Mathcad n=1000 .





Modeling the color of a fish through its genotype (Mathcad)
(Mathcad)

YouTube , .. , β€” . , , , Python, Mathcad , . .








All Articles