/Mendel-s_First_Law

Ruby script that calculates probability that two randomly selected mating organisms will produce an individual possessing a dominant allele given 3 numbers k, m and n being homozygous dominant, heterozygous and homozygous recessive respectively.

Primary LanguageRuby

Mendel's First Law the ROSALIND project

Given: Three positive integers k, m, and n, representing a population containing k+m+n organisms: k individuals are homozygous dominant for a factor, m are heterozygous, and n are homozygous recessive.

Return: The probability that two randomly selected mating organisms will produce an individual possessing a dominant allele (and thus displaying the dominant phenotype). Assume that any two organisms can mate.

http://rosalind.info/problems/iprb/

Sample Dataset - Sample Output

  • 2 2 2 - 0.78333