hardyweinberg.py

Created by elodie-gamot

Created on April 20, 2022

407 Bytes

E1 effectif de l’allèle A//A E2 effectif de l’allèle A//B E3 effectif de l’allèle B//B


from math import *
from matplotlib.pyplot import *
E1=int(input("E1="))
E2=int(input("E2="))
E3=int(input("E3="))
AA=[E1]
AB=[E2]
BB=[E3]
pop=E1+E2+E3
for i in range(2):
  p=(E1+0.5*E2)/pop
  q=(E3+0.5*E2)/pop
  E1=pop*p**2
  E2=2*p*q*pop
  E3=pop*q**2
  AA.append(round(E1))
  AB.append(round(E2))
  BB.append(round(E3))
X=[i for i in range(3)]
plot(X,AA)
plot(X,AB)
plot(X,BB)
show()

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our <a href="https://www.numworks.com/legal/cookies-policy/">cookies policy</a>.