classification
Title: Add math.tau
Type: enhancement Stage: needs patch
Components: Versions:
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: benjamin.peterson, eric.araujo, georg.brandl, gvanrossum, haypo, mark.dickinson, ncoghlan, pitrou, python-dev, rhettinger, sbaird, stutzbach, waldir
Priority: normal Keywords: easy

Created on 2011-06-16 03:10 by ncoghlan, last changed 2013-03-16 07:02 by terry.reedy. This issue is now closed.

Messages (14)
msg138412 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2011-06-16 03:10
I'd like to add a new constant to the math module:

  tau = 2*math.pi

Rather than repeating all the reasons for why tau makes more sense than pi as the fundamental circle constant, I'll just refer interested readers to http://tauday.com/
msg138414 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2011-06-16 03:50
Perhaps we should wait until \tau gains popularity larger than some impassioned physicist. \tau has been used to represent the golden ratio longer.
msg138416 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2011-06-16 06:12
-1
msg138419 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2011-06-16 10:32
The golden ratio is more commonly denoted with phi (although tau does get used sometimes).

Popularity isn't the point though, it's the fact that tau *makes geometric sense* in ways that 2*pi doesn't.
msg138421 - (view) Author: STINNER Victor (haypo) * (Python committer) Date: 2011-06-16 10:43
I like this issue number, but I don't think that Python needs this new constant: it's trivial to add it to your own project. We have pi and e, it's enough. If we begin to add a new constant, others will ask to add much more constants, and there are million of other constants (useful or not). You may want to create a library of some other common constants. You can use float.fromhex() to have a good accuracy.
msg138422 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2011-06-16 11:16
Nick, you just have to write: tau = 2 * math.pi
and you're done.

> there are million of other constants

Actually, I've heard there are an infinity of them.
msg138423 - (view) Author: STINNER Victor (haypo) * (Python committer) Date: 2011-06-16 11:31
> Actually, I've heard there are an infinity of them.

Can you prove that?
msg138431 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2011-06-16 13:20
2011/6/16 STINNER Victor <report@bugs.python.org>:
>
> STINNER Victor <victor.stinner@haypocalc.com> added the comment:
>
>> Actually, I've heard there are an infinity of them.
>
> Can you prove that?

Don't have to. Axiom of infinity. :)
msg138548 - (view) Author: Daniel Stutzbach (stutzbach) (Python committer) Date: 2011-06-17 20:33
On Wed, Jun 15, 2011 at 8:10 PM, Nick Coghlan <report@bugs.python.org>wrote:

> I'd like to add a new constant to the math module:
>
>  tau = 2*math.pi
>
> Rather than repeating all the reasons for why tau makes more sense than pi
> as the fundamental circle constant, I'll just refer interested readers to
> http://tauday.com/

(The following is best if read aloud using your best pirate impression)

I'd rather name the new constant "matey".  Then we have:

The circumference of a circle is: r matey
The area of a circle is: one-quarter r r matey
etc.
msg138551 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2011-06-17 21:04
Not to mention d(area of circle of radius r) = r dr matey.
msg138553 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2011-06-17 21:14
> http://tauday.com/

And I thought putting "dx" directly next to the integral sign was audacious...
msg139338 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2011-06-27 23:37
Uh, not until I've seen a lot more evidence that people are habitually writing "TAU = 2 * math.pi" in their programs...
msg183004 - (view) Author: Simon Baird (sbaird) Date: 2013-02-26 00:17
https://github.com/search?q=%22TAU+%3D+2+%2A+Math.PI%22&type=Code
https://github.com/search?q=%22TAU+%3D+PI+*+2%22&type=Code
msg183198 - (view) Author: Waldir Pimenta (waldir) Date: 2013-02-28 03:13
Following-up sbaird's comment, I must point out that those aren't Python-specific results. Filtering them by appending &l=python to the urls yields:
- "TAU = 2 * Math.PI": 6
- "TAU = 2*Math.PI": 2
- "TAU=2*Math.PI": 0
- "TAU = Math.PI * 2": 0
- "TAU = Math.PI*2": 2
- "TAU=Math.PI*2": 1
(total: 11)

- "TAU = 2 * PI": 9
- "TAU = 2*PI": 12
- "TAU=2*PI": 0
- "TAU = PI * 2": 2
- "TAU = PI*2": 0
- "TAU=PI*2": 0
(total: 23)

Then again, the results for all languages are still helpful to estimate the overall adoption of the notation in code, and indeed the global usage of these patterns (in github only) is in the hundreds.

Also, it's worth taking a look at the usage of the twopi constant, which is already defined in several languages (http://en.wikipedia.org/w/index.php?oldid=509096802#Support_in_programming_languages), and has been manually defined in python quite often, proving its usefulness:

- https://github.com/search?l=python&q=twopi&type=Code (~2k results in python, and ~58k overall)
- https://github.com/search?l=python&q=two_pi&type=Code (~200 results in python, ~23k overall)
History
Date User Action Args
2013-03-16 07:02:43terry.reedysetmessages: - msg184297
2013-03-16 07:01:54python-devsetnosy: + python-dev
messages: + msg184297
2013-02-28 03:13:26waldirsetnosy: + waldir
messages: + msg183198
2013-02-26 00:17:05sbairdsetmessages: + msg183004
2011-07-26 14:26:51eric.araujosetfiles: - unnamed
2011-07-26 14:26:49eric.araujosetnosy: + eric.araujo
2011-06-27 23:37:41gvanrossumsetnosy: + gvanrossum
messages: + msg139338
2011-06-17 21:14:55georg.brandlsetnosy: + georg.brandl
messages: + msg138553
2011-06-17 21:04:54mark.dickinsonsetnosy: + mark.dickinson
messages: + msg138551
2011-06-17 20:33:38stutzbachsetfiles: + unnamed

messages: + msg138548
nosy: + stutzbach
2011-06-16 23:09:47sbairdsetnosy: + sbaird
2011-06-16 13:20:30benjamin.petersonsetmessages: + msg138431
2011-06-16 11:40:47pitrousetstatus: open -> closed
2011-06-16 11:31:46hayposetstatus: pending -> open

messages: + msg138423
2011-06-16 11:16:58pitrousetstatus: open -> pending

nosy: + pitrou
messages: + msg138422

resolution: rejected
2011-06-16 10:43:27hayposetnosy: + haypo
messages: + msg138421
2011-06-16 10:32:19ncoghlansetmessages: + msg138419
2011-06-16 06:12:23rhettingersetnosy: + rhettinger
messages: + msg138416
2011-06-16 03:50:34benjamin.petersonsetnosy: + benjamin.peterson
messages: + msg138414
2011-06-16 03:10:29ncoghlancreate