Grupos de Google ya no admite nuevas publicaciones ni suscripciones de Usenet. El contenido anterior sigue siendo visible.

An amazing one-minute bit of fun at the interactive prompt

Visto 58 veces
Saltar al primer mensaje no leído

Raymond Hettinger

no leída,
20 feb 2011, 3:08:5820/2/11
a
>>> e = 10.0 ** -7; n = 0; z = c = complex(-0.75, e)
>>> while abs(z) < 2.0:
n += 1
z = z * z + c

>>> n * e
3.1415926

Compute π ± e by counting Mandlebrot set iterations :-)


Raymond

Raymond Hettinger

no leída,
20 feb 2011, 3:11:3220/2/11
a
> Compute ð ± e by counting Mandlebrot set iterations :-)

That should be: pi plus-or-minus e

Raymond

Ben Finney

no leída,
20 feb 2011, 6:42:1720/2/11
a
Raymond Hettinger <pyt...@rcn.com> writes:

> Compute π ± e by counting Mandlebrot set iterations :-)

Very cool! I love π nerdery.


Raymond Hettinger <pyt...@rcn.com> writes:

> > Compute ð ± e by counting Mandlebrot set iterations :-)
>
> That should be: pi plus-or-minus e

It was in my reader. Perhaps your server has encoding trouble?

--
\ Moriarty: “Forty thousand million billion dollars? That money |
`\ must be worth a fortune!” —The Goon Show, _The Sale of |
_o__) Manhattan_ |
Ben Finney

Martin Gregorie

no leída,
20 feb 2011, 8:03:0520/2/11
a
On Sun, 20 Feb 2011 22:42:17 +1100, Ben Finney wrote:

> Raymond Hettinger <pyt...@rcn.com> writes:
>
>> Compute π ± e by counting Mandlebrot set iterations :-)
>
> Very cool! I love π nerdery.
>
>
> Raymond Hettinger <pyt...@rcn.com> writes:
>
>> > Compute ð ± e by counting Mandlebrot set iterations :-)
>>
>> That should be: pi plus-or-minus e
>
> It was in my reader. Perhaps your server has encoding trouble?

Same here (Pan reader, Fedora 14).

--
martin@ | Martin Gregorie
gregorie. | Essex, UK
org |

Steven D'Aprano

no leída,
20 feb 2011, 8:42:2620/2/11
a
On Sun, 20 Feb 2011 00:08:58 -0800, Raymond Hettinger wrote:

>>>> e = 10.0 ** -7; n = 0; z = c = complex(-0.75, e)
>>>> while abs(z) < 2.0:
> n += 1
> z = z * z + c
>
>>>> n * e
> 3.1415926

Absolutely brilliant! That alone justifies including complex as a built-
in type. *wink*


> Compute π ± e by counting Mandlebrot set iterations :-)

eps would be a better name than e. As I read it, π ± e would be some
number between 0.423310825130748 and 5.859874482048838, which isn't a
terribly impressive approximation :)

BTW, I see the symbol in your post as π (pi), not ð (lowercase eth).

--
Steven

Anssi Saari

no leída,
20 feb 2011, 12:41:3620/2/11
a
Ben Finney <ben+p...@benfinney.id.au> writes:

> Raymond Hettinger <pyt...@rcn.com> writes:
>
>> Compute π ± e by counting Mandlebrot set iterations :-)
>
> Very cool! I love π nerdery.
>
>
> Raymond Hettinger <pyt...@rcn.com> writes:
>
>> > Compute ð ± e by counting Mandlebrot set iterations :-)
>>
>> That should be: pi plus-or-minus e
>
> It was in my reader. Perhaps your server has encoding trouble?

He (or rather Google) used iso-8859-7 as a character set, which is the
Latin/Greek alphabet and definitely has pi at 0xF0. Not exactly a
common character set though. Running a iso-8859-1 font in a terminal
means I see a ? instead of pi...

Roy Smith

no leída,
20 feb 2011, 13:22:0520/2/11
a
In article <87oc679...@benfinney.id.au>,
Ben Finney <ben+p...@benfinney.id.au> wrote:

> Raymond Hettinger <pyt...@rcn.com> writes:
>
> > Compute � � e by counting Mandlebrot set iterations :-)
>
> Very cool! I love � nerdery.


>
>
> Raymond Hettinger <pyt...@rcn.com> writes:
>
> > > Compute ð ± e by counting Mandlebrot set iterations :-)
> >
> > That should be: pi plus-or-minus e
>
> It was in my reader. Perhaps your server has encoding trouble?

He was probably reading the nroff man page.

(ducking and running)

Martin v. Loewis

no leída,
20 feb 2011, 13:46:1020/2/11
a Steven D'Aprano
> eps would be a better name than e.

py> ε = 10.0 ** -7; n = 0; z = c = complex(-0.75, ε)
py> while abs(z) < 2.0:
... n += 1
... z = z * z + c
...
py> π = n * ε
py> print(π)
3.1415926

Regards,
Martin

Ben Finney

no leída,
20 feb 2011, 16:32:4520/2/11
a
Anssi Saari <a...@sci.fi> writes:

> Ben Finney <ben+p...@benfinney.id.au> writes:
> > It [appeared correctly] in my reader. Perhaps your server has


> > encoding trouble?
>
> He (or rather Google) used iso-8859-7 as a character set, which is the
> Latin/Greek alphabet and definitely has pi at 0xF0. Not exactly a
> common character set though. Running a iso-8859-1 font in a terminal
> means I see a ? instead of pi...

Another good reason to eschew legacy encodings and use a Unicode
character encoding for all internet messages, like the extremely common
UTF-8. Get to it, Raymond! :-)

--
\ “I knew things were changing when my Fraternity Brothers threw |
`\ a guy out of the house for mocking me because I'm gay.” |
_o__) —postsecret.com, 2010-01-19 |
Ben Finney

Mark Dickinson

no leída,
21 feb 2011, 3:08:3421/2/11
a
On Feb 20, 8:08 am, Raymond Hettinger <pyt...@rcn.com> wrote:
> [...]
> >>> n * e
>
> 3.1415926
>
> Compute ð ± e by counting Mandlebrot set iterations :-)

Very neat! Is it supposed to be obvious why this gives an
approximation to pi? If so, I'll think about it a bit more; if not,
do you have any references?

Maybe you should have saved this for March 14th...

Mark

Raymond Hettinger

no leída,
21 feb 2011, 19:53:0921/2/11
a
On Feb 21, 12:08 am, Mark Dickinson <dicki...@gmail.com> wrote:
> On Feb 20, 8:08 am, Raymond Hettinger <pyt...@rcn.com> wrote:
>
> > [...]
> > >>> n * e
>
> > 3.1415926

> Very neat!  Is it supposed to be obvious why this gives an


> approximation to pi?  If so, I'll think about it a bit more;  if not,
> do you have any references?

Even after reading the proof, I still don't find it to be obvious ;-)

http://home.comcast.net/~davejanelle/mandel.pdf


Raymond

0 mensajes nuevos