[Python-Dev] [OT] Denormalized fractions [was Re: PEP 3144 review.]

2009-09-29 Thread Steven D'Aprano
On Tue, 29 Sep 2009 01:18:43 pm Guido van Rossum wrote:
 I've never heard of someone who had a use case for
 denormalized fractions

Off-topic, but for what it's worth, I have one -- there's a mathematical 
operator called the mediant:

mediant(a/b, c/d) = (a+c)/(b+d)

It has a few uses, including Farey fractions. Clearly the result you get 
from normalized fractions will be different from denormalized (compare 
mediant(1/2, 3/4) with mediant(5/10, 3/4)). This leads to Simpson's 
Paradox, which is of importance in medical research:

http://en.wikipedia.org/wiki/Simpson's_paradox

Brief summary: consider two medical studies comparing two different 
treatments for an illness, treatment A and B. According to the first 
study, treatment A is better; according to the second study, treatment 
A is also better. But combining the results of the two studies into a 
single comparison paradoxically shows that treatment B is better!

The mediant is fascinating (to maths geeks at least) and important, and 
you need denormalized fractions.



-- 
Steven D'Aprano
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] [OT] Denormalized fractions [was Re: PEP 3144 review.]

2009-09-29 Thread Greg Ewing

Steven D'Aprano wrote:

there's a mathematical operator called the mediant:

mediant(a/b, c/d) = (a+c)/(b+d)


That's a function of four arguments, not two!

--
Greg

___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com