Talk:Pi: Difference between revisions

5,783 bytes added ,  2 years ago
→‎Python: new section
(→‎Pi vs tau: I think we're in agreement.)
(→‎Python: new section)
 
(18 intermediate revisions by 8 users not shown)
Line 1:
==stopping the program==
Why "until a key is pressed"? That's an annoyingly non-portable construct. --[[User:Rdm|Rdm]] 22:20, 25 March 2011 (UTC)
 
Line 7 ⟶ 8:
 
I agree. There are computers without a keyboard, and special industrial keyboards with the break key removed. If there is no facility to terminate the process, then it should run for infinity for the purposes of this task. I have updated the wording to clarify this point.
 
: There are keyboards without a break key. Not all keyboards are hooked up to a PC or an ASCII computer. -- [[User:Gerard Schildberger|Gerard Schildberger]] 08:44, 27 March 2012 (UTC)
 
[[User:Markhobley|Markhobley]] 10:57, 26 March 2011 (UTC)
Line 66 ⟶ 69:
:::Hm. It might be worth scrapping the task and creating more defined ones, such as [[Pi/Bailey-Borwein-Plouffe]], and leave the "Pi/" namespace available to other specific implementations.--[[User:Short Circuit|Michael Mol]] 15:03, 26 July 2011 (UTC)
:::[[Pi]] can be implemented without use of a spigot algorithm regardless of efficiency, because that algorithm is not good at being efficient at all. The C program I wrote continuous generates Pi digits faster than the unbound spigot, despite the algorithm used was totally unsuitable for the task. --[[User:Ledrug|Ledrug]] 00:07, 27 July 2011 (UTC)
:I would favour leaving the task as it is (but with the impossible requirement to continue 'forever' replaced with something like 'until resources are exhausted'). Specifying only that the digits are generated 'in succession' gives a choice between using an unbounded Spigot algorithm (which requires support for arbitrary-precision arithmetic) and a 'bounded' algorithm configured to use all the available memory (which better suits languages with fixed-size integers). Whichever approach is used, the number of digits that can be generated is limited by memory size. [[User:RichardRussell|RichardRussell]] 14:37, 12 November 2012 (UTC)
 
== C# - incorrect solution ==
The C# version produces output where only first 30% is correct, then goes garbage. For example, here's what it outputs when asked for 50 digits:
3141592653589792800649014751202138549699509907712322 while correct digits are
3141592653589793238462643383279502884197169399375105.
The D version which uses similar but slightly different algorithm is correct.
--[[User:thedeemon|thedeemon]] 24 October 2012
 
 
: I split the two above values of &nbsp; <big><big><math>\pi</math></big></big> &nbsp; (sans a decimal point) &nbsp; so that it can be easily compared, and I also added an up arrow &nbsp; (↑) &nbsp; indicating to the unequal (different) decimal digit. &nbsp; I realize that (normally) editing other people's edits are frowned on and considered a no-no, &nbsp; but the intent is to easily compare two different values of &nbsp; <big><big><math>\pi</math></big></big>. &nbsp; &nbsp; -- [[User:Gerard Schildberger|Gerard Schildberger]] ([[User talk:Gerard Schildberger|talk]]) 09:45, 24 September 2018 (UTC)
 
== Pi vs tau ==
Line 79 ⟶ 94:
:::: Second, I was far more concerned about scenarios involving geometric tasks which chose to use {{tau}} rather than {{pi}}, as each of those tasks would need to note how to derive {{tau}} from {{pi}}, which would complicate them. (A trivial complication yes, but still a reduction in their simplicity)--[[User:Short Circuit|Michael Mol]] 13:37, 2 August 2011 (UTC)
:::: Third, I really wouldn't mind a [[Pi/Pi and Tau]] which showed how convert from pi to tau and back. That kind of triviality isn't something that bothers me, though it may tend to bother contributors who are completeness-driven. --[[User:Short Circuit|Michael Mol]] 13:37, 2 August 2011 (UTC)
: I prefer <math>\pi</math>, because of [[wp:Euler's identity|Euler's awesome identity]]:
:: <math>e^{i\pi} + 1 = 0</math>
: That is an amazingly significant formula, “simply” linking 5 of the key constants into one piece. There is no way that <math>\tau</math> would work nearly so well in it; it's not coupled to the transcendental functions in such a direct fashion. (Also, you use <math>\pi</math> directly when working with circular areas, and neither <math>\pi</math> nor <math>\tau</math> is great for spherical volumes or their equivalents in higher dimensions.) –[[User:Dkf|Donal Fellows]] 21:28, 11 February 2012 (UTC)
:: Well, of course -- if you replace the terms in the equation with something different, you need to change the equation if you want the result to be valid. That's just basic math. In this case, a valid pair of changes are: "replace pi with tau (or vice versa)" and "swap the positions of the + and the =". In other words: '''<math>e^{i\tau} = 1 + 0</math>'''. You might also want to swap <math>i</math> and <math>\tau</math> depending on the font you are using (<math>e^{\tau i} = 1 + 0</math>), but multiplication is commutative with complex numbers, so that will not change the equation's validity.
:: As for the general case of n dimensions... I was going to look that up, but currently wikipedia says that the proportionality constant for volume of a [[wp:N-sphere|hypersphere]] is <math>V_n (R) = C_n R^n</math> where <math>C_n = \frac{\pi^\frac{n}{2}}{\Gamma(\frac{n}{2} + 1)} \,</math> but that gives the same result for <math>C_n</math> for both n=2 and n=3 so it can't be right. So, for now, I will take your word that it gets messy. It's been ages since I thought about this issue. Still, as motivation for a task? I do not think that we exclude tasks based on this kind of mathematical popularity issue... --[[User:Rdm|Rdm]] 16:34, 12 February 2012 (UTC)
 
== Julia Output ==
 
I'm not sure there's necessarily anything wrong with the code, so I didn't want to mark it incorrect, but the output for the Julia sample is clearly wrong - there are several places in the sequence where the character 'e' appears. Is there a more appropriate template that can be used to mark it as needing attention. I'm not a Julia programmer myself, so it's not something I can easily confirm as correct or incorrect. --[[User:J4 james|j4_james]] ([[User talk:J4 james|talk]]) 16:47, 3 October 2015 (UTC)
 
 
== Formula for JAVA ==
By what formula did you calculate pi in JAVA? I searched hard in wikipedia, and found nothing this good. What formula do you use?
 
Also - the first 50 digits are exact - but is the whole formula exact? Or is it diverges after some digits? [[User:DeatH StaR|DeatH StaR]] ([[User talk:DeatH StaR|talk]]) 20:55, 13 October 2016 (UTC)
 
== pascal ==
when i compile i get: Error: Identifier not found "result"
 
=== different output ===
i solved the above problem by adding oneloop:=result before the end of the function but:
when i run the program to calculate thousand digits of pi i get an output with the last digits 62429841642 which is completely different from the output published at the wiki page.
 
== my password ==
My password is the last 8 digits of &nbsp; <big><big><math>\pi</math></big></big>. &nbsp; &nbsp; &nbsp; &nbsp; -- [[User:Gerard Schildberger|Gerard Schildberger]] ([[User talk:Gerard Schildberger|talk]]) 13:29, 29 November 2019 (UTC)
 
 
=== Happy Pi Day! ===
--[[User:Xdv|xarilaos]] ([[User talk:Xdv|talk]]) 14:31, 14 March 2022 (UTC)
 
== javascript ==
 
webpage version is working!
(Note for javascript developers: please provide webpage versions, we are not professionals.)
 
== Java ==
 
It works!--[[User:Xdv|xarilaos]] ([[User talk:Xdv|talk]]) 14:04, 15 March 2022 (UTC)
 
== Python ==
 
It works!--[[User:Xdv|xarilaos]] ([[User talk:Xdv|talk]]) 14:06, 15 March 2022 (UTC)
Anonymous user