Skip to content

Define the TAU circle constant [Feature #4897] #644

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

simonbaird
Copy link

  • Define TAU constant in math.c similar to PI.
  • Define TAU method in bigdecimal/math based on existing
    PI method.

@simonbaird
Copy link
Author

I tested like this:

oubliette:~/dev/ruby> [trunk_define_tau] /usr/local/bin/ruby -r bigdecimal/math -e 'puts Math::PI, BigMath.PI(20), Math::TAU, BigMath.TAU(20)'
3.141592653589793
0.3141592653589793238462643383279502884519859293521427E1
6.283185307179586
0.6283185307179586476925286766559005769039718587042854E1

@simonbaird
Copy link
Author

@@ -180,7 +181,7 @@ def atan(x, prec)
# #=> "0.3141592653589793238462643388813853786957412E1"
#
def PI(prec)
raise ArgumentError, "Zero or negative argument for PI" if prec <= 0
raise ArgumentError, "Zero or negative precision for PI" if prec <= 0
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me know if you don't like this. I'm happy to leave it as 'argument' if that is preferred. My thoughts are that precision is a better word and it is consistent with the message in the E method below.

nobu added a commit that referenced this pull request Jun 28, 2014
* ext/bigdecimal/lib/bigdecimal/math.rb (BigMath#PI): change error
  message about zero or negative precision for clarity and
  consistency with other methods.  [GH-644]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46600 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
@simonbaird
Copy link
Author

Rebased on top of 38f0133 "bigdecimal/math.rb: error message in BigMath#PI"

@thoran
Copy link

thoran commented Jul 6, 2014

Simon, I think you've erred in putting PI first. Shouldn't TAU be first? Or perhaps they should be in alphabetical order: E, PI, TAU? Thanks for this patch and raising my awareness of Tau. I'm a Tau convert now too...

@simonbaird
Copy link
Author

@thoran (Not sure if you're totally serious, but) I don't think changing the order is necessary or sensible. Glad to hear Tau has another convert.. :)

mmasaki pushed a commit to mmasaki/ruby that referenced this pull request Aug 10, 2014
* ext/bigdecimal/lib/bigdecimal/math.rb (BigMath#PI): change error
  message about zero or negative precision for clarity and
  consistency with other methods.  [rubyGH-644]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46600 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* math.c: Define TAU constant in similar to PI constant.
* ext/bigdecimal/lib/bigdecimal/math.rb: Define TAU method in
  bigdecimal/math based on existing PI method.
@mrkn
Copy link
Member

mrkn commented Jul 9, 2015

@simonbaird Please tell me how popular is tau in the community of mathematicians and physicians. I don't have any idea of it. I want to know how many research papers or textbooks using this new constant definition have been published as of today.

@simonbaird
Copy link
Author

@mrkn Take a look here. It shows a year by year list of Tau related highlights including some books and publications that use it.

@simonbaird
Copy link
Author

@gogotanaka
Copy link
Member

@simonbaird Hi! Thank you for working on it. While leaving a decision to @mrkn san, let me say something here.

Tau makes more sense than pi to me and is important constant as you show. I personally love this number.
But I really doubt whether it worth having tau as constant in Ruby. There are a lot of other math constants which are also important. And E and PI are top two of special one, very special. While Nobody complain about having E and PI as constant, discussing about how important other constants(Tau) is and worth it are kind of difficult.

@simonbaird
Copy link
Author

The two most important constants in mathematics are e and "the circle constant". And, (according to the Tau supporters, myself included), the circle constant is Tau. So that's why I don't think the "slippery slope" argument, i.e. "if we add Tau then people will want to add many other constants" is valid.

Nevertheless, I understand the decision about whether to merge this is not a clear one. Here's some of my thoughts why it could be merged:

  • It won't hurt anyone
  • It can help further the acceptance and adoption of Tau (which I believe is a good thing for the world)

How about asking "why not" instead of "why"?

@mrkn
Copy link
Member

mrkn commented Jul 20, 2015

@simonbaird I decided to reject this proposal. The reasons is:

@mrkn mrkn closed this Jul 20, 2015
@simonbaird
Copy link
Author

Okay, your reasoning is very sensible and well explained. Thanks very much for the consideration. Best wishes, Simon.

@waldyrious
Copy link

I found that Python and Julia rejected similar proposals. See https://bugs.python.org/issue12345 and JuliaLang/julia#4864.

Just FYI, Python actually ended up incorporating the proposal: issue 12345 is now marked as solved -- by Guido himself, no less :)

@renewooller
Copy link

Can we please reopen this issue? even iOS messenger and google calculator has TAU now... It makes a lot of maths easier and more intuitive because the definition for the circle constant is then based on radius rather than diameter, same as radians.

@mrkn
Copy link
Member

mrkn commented Jan 5, 2025

even iOS messenger and google calculator has TAU now...

@renewooller I’m not sure how to use TAU in the iOS messenger, and I haven’t been able to confirm whether Google’s calculator supports TAU. As far as I can tell, both Google’s web calculator and Chrome’s built-in calculator only offer pi.

IMG_4680
IMG_4679

Could you please let me know how I can verify that TAU is available in these calculators?

By the way, the only criterion for deciding whether TAU can be included as a constant in the Math module is how frequently it appears in academic mathematics papers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants