Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #65415 > unrolled thread

Finding size of Variable

Started byAyushi Dalmia <ayushidalmia2604@gmail.com>
First post2014-02-04 03:28 -0800
Last post2014-02-05 15:22 +0000
Articles 20 on this page of 159 — 30 participants

Back to article view | Back to comp.lang.python


Contents

  Finding size of Variable Ayushi Dalmia <ayushidalmia2604@gmail.com> - 2014-02-04 03:28 -0800
    Re: Finding size of Variable Peter Otten <__peter__@web.de> - 2014-02-04 12:40 +0100
      Re: Finding size of Variable Ayushi Dalmia <ayushidalmia2604@gmail.com> - 2014-02-04 04:43 -0800
        Re: Finding size of Variable Asaf Las <roegltd@gmail.com> - 2014-02-04 04:53 -0800
          Re: Finding size of Variable Ayushi Dalmia <ayushidalmia2604@gmail.com> - 2014-02-04 05:18 -0800
        Re: Finding size of Variable Dave Angel <davea@davea.name> - 2014-02-04 08:09 -0500
          Re: Finding size of Variable Ayushi Dalmia <ayushidalmia2604@gmail.com> - 2014-02-04 05:19 -0800
            Re: Finding size of Variable Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-02-04 09:06 -0500
              Re: Finding size of Variable Ayushi Dalmia <ayushidalmia2604@gmail.com> - 2014-02-04 21:00 -0800
    Re:Finding size of Variable Dave Angel <davea@davea.name> - 2014-02-04 14:21 -0500
      Re: Finding size of Variable Ayushi Dalmia <ayushidalmia2604@gmail.com> - 2014-02-04 21:15 -0800
        Re: Finding size of Variable Peter Otten <__peter__@web.de> - 2014-02-05 09:27 +0100
    Re: Finding size of Variable Tim Golden <mail@timgolden.me.uk> - 2014-02-04 19:28 +0000
    Re: Finding size of Variable Tim Chase <python.list@tim.thechases.com> - 2014-02-04 13:29 -0600
      Re: Finding size of Variable Ayushi Dalmia <ayushidalmia2604@gmail.com> - 2014-02-04 21:35 -0800
        Re: Finding size of Variable Rustom Mody <rustompmody@gmail.com> - 2014-02-04 21:45 -0800
          Re: Finding size of Variable Ayushi Dalmia <ayushidalmia2604@gmail.com> - 2014-02-04 22:00 -0800
        Re: Finding size of Variable Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-02-05 11:00 +0000
          Re: Finding size of Variable Chris Angelico <rosuav@gmail.com> - 2014-02-05 22:44 +1100
            Re: Finding size of Variable wxjmfauth@gmail.com - 2014-02-06 02:15 -0800
              Re: Finding size of Variable Ned Batchelder <ned@nedbatchelder.com> - 2014-02-06 06:10 -0500
                Re: Finding size of Variable wxjmfauth@gmail.com - 2014-02-06 05:51 -0800
                  Re: Finding size of Variable wxjmfauth@gmail.com - 2014-02-06 06:15 -0800
                  Re: Finding size of Variable Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-02-08 02:48 +0000
                    Re: Finding size of Variable Ethan Furman <ethan@stoneleaf.us> - 2014-02-07 19:02 -0800
                    Re: Finding size of Variable Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-02-08 13:17 +0000
                    Re: Finding size of Variable David Hutto <dwightdhutto@gmail.com> - 2014-02-08 17:45 -0500
                      Re: Finding size of Variable Rustom Mody <rustompmody@gmail.com> - 2014-02-08 17:25 -0800
                        Re: Finding size of Variable David Hutto <dwightdhutto@gmail.com> - 2014-02-08 21:56 -0500
                        Re: Finding size of Variable Chris Angelico <rosuav@gmail.com> - 2014-02-09 13:59 +1100
                        Re: Finding size of Variable David Hutto <dwightdhutto@gmail.com> - 2014-02-08 22:07 -0500
                        Re: Finding size of Variable Ned Batchelder <ned@nedbatchelder.com> - 2014-02-08 22:09 -0500
                        Re: Finding size of Variable David Hutto <dwightdhutto@gmail.com> - 2014-02-08 22:09 -0500
                        Re: Finding size of Variable Ned Batchelder <ned@nedbatchelder.com> - 2014-02-08 22:16 -0500
                          Re: Finding size of Variable Rustom Mody <rustompmody@gmail.com> - 2014-02-08 19:30 -0800
                    Re: Finding size of Variable wxjmfauth@gmail.com - 2014-02-10 06:07 -0800
                      Re: Finding size of Variable Asaf Las <roegltd@gmail.com> - 2014-02-10 06:25 -0800
                        Re: Finding size of Variable Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-02-10 14:39 +0000
                      Re: Finding size of Variable Tim Chase <python.list@tim.thechases.com> - 2014-02-10 08:43 -0600
                        Re: Finding size of Variable wxjmfauth@gmail.com - 2014-02-11 10:53 -0800
                          Re: Finding size of Variable Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-02-11 19:04 +0000
                            Re: Finding size of Variable wxjmfauth@gmail.com - 2014-02-11 23:49 -0800
                              Re: Finding size of Variable Chris Angelico <rosuav@gmail.com> - 2014-02-12 19:06 +1100
                                Re: Finding size of Variable Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2014-02-12 10:57 +0200
                                  Re: Finding size of Variable Chris Angelico <rosuav@gmail.com> - 2014-02-12 20:24 +1100
                                    Re: Finding size of Variable Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2014-02-12 11:35 +0200
                              Working with the set of real numbers (was: Finding size of Variable) Ben Finney <ben+python@benfinney.id.au> - 2014-02-12 19:17 +1100
                                Re: Working with the set of real numbers (was: Finding size of Variable) wxjmfauth@gmail.com - 2014-02-12 00:35 -0800
                                  Re: Working with the set of real numbers (was: Finding size of Variable) wxjmfauth@gmail.com - 2014-02-12 00:46 -0800
                                  Re: Working with the set of real numbers Ben Finney <ben+python@benfinney.id.au> - 2014-02-12 19:52 +1100
                                Re: Working with the set of real numbers (was: Finding size of Variable) Grant Edwards <invalid@invalid.invalid> - 2014-02-12 15:24 +0000
                                  Re: Working with the set of real numbers (was: Finding size of Variable) "Gisle Vanem" <gvanem@yahoo.no> - 2014-02-12 17:23 +0100
                              Re: Working with the set of real numbers (was: Finding size of Variable) Chris Angelico <rosuav@gmail.com> - 2014-02-12 19:47 +1100
                                Re: Working with the set of real numbers (was: Finding size of Variable) Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2014-02-12 11:23 +0200
                                Re: Working with the set of real numbers (was: Finding size of Variable) albert@spenarnc.xs4all.nl (Albert van der Horst) - 2014-03-04 02:45 +0000
                                  Re: Working with the set of real numbers (was: Finding size of Variable) Chris Angelico <rosuav@gmail.com> - 2014-03-04 14:02 +1100
                                    Re: Working with the set of real numbers (was: Finding size of Variable) Rustom Mody <rustompmody@gmail.com> - 2014-03-03 19:13 -0800
                                      Re: Working with the set of real numbers (was: Finding size of Variable) Chris Angelico <rosuav@gmail.com> - 2014-03-04 14:46 +1100
                                        Re: Working with the set of real numbers (was: Finding size of Variable) Rustom Mody <rustompmody@gmail.com> - 2014-03-03 21:19 -0800
                                        Re: Working with the set of real numbers (was: Finding size of Variable) Steven D'Aprano <steve@pearwood.info> - 2014-03-04 05:53 +0000
                                          Re: Working with the set of real numbers (was: Finding size of Variable) Chris Angelico <rosuav@gmail.com> - 2014-03-04 17:35 +1100
                                            Re: Working with the set of real numbers Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-03-05 00:05 +1300
                                              Re: Working with the set of real numbers Chris Angelico <rosuav@gmail.com> - 2014-03-04 23:43 +1100
                                            Re: Working with the set of real numbers Marko Rauhamaa <marko@pacujo.net> - 2014-03-04 21:49 +0200
                                              Re: Working with the set of real numbers Chris Angelico <rosuav@gmail.com> - 2014-03-05 06:58 +1100
                                              Re: Working with the set of real numbers Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2014-03-04 20:55 +0000
                                                Re: Working with the set of real numbers Marko Rauhamaa <marko@pacujo.net> - 2014-03-04 23:05 +0200
                                                  Re: Working with the set of real numbers Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2014-03-04 22:08 +0000
                                              Re: Working with the set of real numbers Chris Angelico <rosuav@gmail.com> - 2014-03-05 08:18 +1100
                                              Re: Working with the set of real numbers Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2014-03-04 22:02 +0000
                                              Re: Working with the set of real numbers Chris Angelico <rosuav@gmail.com> - 2014-03-05 09:18 +1100
                                              Re: Working with the set of real numbers Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2014-03-04 22:54 +0000
                                              Re: Working with the set of real numbers Chris Angelico <rosuav@gmail.com> - 2014-03-05 10:01 +1100
                                              Re: Working with the set of real numbers Dave Angel <davea@davea.name> - 2014-03-04 18:20 -0500
                                              Re: Working with the set of real numbers Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2014-03-05 11:59 +0000
                                              Re: Working with the set of real numbers Dave Angel <davea@davea.name> - 2014-03-05 07:57 -0500
                                              Re: Working with the set of real numbers Dave Angel <davea@davea.name> - 2014-03-05 08:32 -0500
                                              Re: Working with the set of real numbers Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2014-03-06 12:27 +0000
                                              Re: Working with the set of real numbers Chris Angelico <rosuav@gmail.com> - 2014-03-07 00:16 +1100
                                          Re: Working with the set of real numbers (was: Finding size of Variable) Ian Kelly <ian.g.kelly@gmail.com> - 2014-03-04 04:19 -0700
                                            Re: Working with the set of real numbers (was: Finding size of Variable) albert@spenarnc.xs4all.nl (Albert van der Horst) - 2014-03-05 02:27 +0000
                                          Re: Working with the set of real numbers (was: Finding size of Variable) Ian Kelly <ian.g.kelly@gmail.com> - 2014-03-04 04:23 -0700
                                    Re: Working with the set of real numbers (was: Finding size of Variable) albert@spenarnc.xs4all.nl (Albert van der Horst) - 2014-03-05 02:15 +0000
                                      Re: Working with the set of real numbers (was: Finding size of Variable) Steven D'Aprano <steve@pearwood.info> - 2014-03-05 03:41 +0000
                                        Re: Working with the set of real numbers (was: Finding size of Variable) Rustom Mody <rustompmody@gmail.com> - 2014-03-04 20:15 -0800
                                          Re: Working with the set of real numbers (was: Finding size of Variable) Roy Smith <roy@panix.com> - 2014-03-04 23:25 -0500
                                            Re: Working with the set of real numbers Ben Finney <ben+python@benfinney.id.au> - 2014-03-05 15:37 +1100
                                              Re: Working with the set of real numbers Rustom Mody <rustompmody@gmail.com> - 2014-03-04 20:57 -0800
                                              Re: Working with the set of real numbers Roy Smith <roy@panix.com> - 2014-03-05 00:29 -0500
                                            Re: Working with the set of real numbers (was: Finding size of Variable) Steven D'Aprano <steve@pearwood.info> - 2014-03-05 07:52 +0000
                                              Re: Working with the set of real numbers (was: Finding size of Variable) Steven D'Aprano <steve@pearwood.info> - 2014-03-05 08:38 +0000
                                                Re: Working with the set of real numbers (was: Finding size of Variable) wxjmfauth@gmail.com - 2014-03-05 01:00 -0800
                                                  Re: Working with the set of real numbers Ned Batchelder <ned@nedbatchelder.com> - 2014-03-05 06:23 -0500
                                              Re: Working with the set of real numbers (was: Finding size of Variable) Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2014-03-05 12:21 +0000
                                                Re: Working with the set of real numbers (was: Finding size of Variable) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-03-05 17:43 +0000
                                                  Re: Working with the set of real numbers (was: Finding size of Variable) Chris Angelico <rosuav@gmail.com> - 2014-03-06 05:01 +1100
                                                  Re: Working with the set of real numbers (was: Finding size of Variable) Chris Kaynor <ckaynor@zindagigames.com> - 2014-03-05 10:03 -0800
                                                    Re: Working with the set of real numbers (was: Finding size of Variable) Grant Edwards <invalid@invalid.invalid> - 2014-03-05 19:13 +0000
                                                  Re: Working with the set of real numbers (was: Finding size of Variable) Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2014-03-05 21:22 +0000
                                                  Re: Working with the set of real numbers (was: Finding size of Variable) Roy Smith <roy@panix.com> - 2014-03-05 21:31 -0500
                                                    Re: Working with the set of real numbers (was: Finding size of Variable) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-03-06 03:06 +0000
                                                      Re: Working with the set of real numbers (was: Finding size of Variable) Chris Angelico <rosuav@gmail.com> - 2014-03-06 14:14 +1100
                                                      Re: Working with the set of real numbers (was: Finding size of Variable) Roy Smith <roy@panix.com> - 2014-03-05 23:05 -0500
                                                    Re: Working with the set of real numbers (was: Finding size of Variable) Grant Edwards <invalid@invalid.invalid> - 2014-03-06 03:34 +0000
                                              Re: Working with the set of real numbers Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-03-05 12:50 +0000
                                                Re: Working with the set of real numbers Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-03-05 17:49 +0000
                              Re: Working with the set of real numbers Ben Finney <ben+python@benfinney.id.au> - 2014-02-12 19:56 +1100
                              Re: Working with the set of real numbers Chris Angelico <rosuav@gmail.com> - 2014-02-12 20:16 +1100
                              Re: Working with the set of real numbers Ben Finney <ben+python@benfinney.id.au> - 2014-02-12 21:07 +1100
                                Re: Working with the set of real numbers Rustom Mody <rustompmody@gmail.com> - 2014-02-12 06:11 -0800
                                  Re: Working with the set of real numbers Ian Kelly <ian.g.kelly@gmail.com> - 2014-02-12 13:45 -0700
                                    Re: Working with the set of real numbers Rustom Mody <rustompmody@gmail.com> - 2014-02-12 17:47 -0800
                                Re: Working with the set of real numbers Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-02-13 11:09 +1300
                                Re: Working with the set of real numbers Steven D'Aprano <steve@pearwood.info> - 2014-02-13 03:31 +0000
                                  Re: Working with the set of real numbers Ben Finney <ben+python@benfinney.id.au> - 2014-02-13 14:45 +1100
                                  Re: Working with the set of real numbers Chris Angelico <rosuav@gmail.com> - 2014-02-13 15:17 +1100
                              Re: Working with the set of real numbers Chris Angelico <rosuav@gmail.com> - 2014-02-12 21:20 +1100
                                Re: Working with the set of real numbers wxjmfauth@gmail.com - 2014-02-12 02:55 -0800
                                  Re: Working with the set of real numbers Ned Batchelder <ned@nedbatchelder.com> - 2014-02-12 06:55 -0500
                                Re: Working with the set of real numbers Marko Rauhamaa <marko@pacujo.net> - 2014-02-12 14:48 +0200
                                  Re: Working with the set of real numbers Chris Angelico <rosuav@gmail.com> - 2014-02-13 00:20 +1100
                                    Re: Working with the set of real numbers Marko Rauhamaa <marko@pacujo.net> - 2014-02-12 16:13 +0200
                                      Re: Working with the set of real numbers Chris Angelico <rosuav@gmail.com> - 2014-02-13 04:52 +1100
                                        Re: Working with the set of real numbers Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-02-13 11:24 +1300
                                          Re: Working with the set of real numbers Dave Angel <davea@davea.name> - 2014-02-12 17:56 -0500
                                            Re: Working with the set of real numbers Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-02-14 18:26 +1300
                              Re: Working with the set of real numbers Ben Finney <ben+python@benfinney.id.au> - 2014-02-12 22:44 +1100
                              Re: Working with the set of real numbers Chris Angelico <rosuav@gmail.com> - 2014-02-12 22:58 +1100
                                Re: Working with the set of real numbers Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-02-13 11:32 +1300
                                  Re: Working with the set of real numbers Grant Edwards <invalid@invalid.invalid> - 2014-02-12 23:23 +0000
                              Re: Finding size of Variable Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-02-12 14:04 +0000
                                Re: Finding size of Variable Rustom Mody <rustompmody@gmail.com> - 2014-02-12 06:14 -0800
                                  Re: Finding size of Variable Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-02-12 14:25 +0000
                                    Re: Finding size of Variable Rustom Mody <rustompmody@gmail.com> - 2014-02-12 06:32 -0800
                              Re: Working with the set of real numbers Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2014-02-13 12:48 +0000
                                Re: Working with the set of real numbers Marko Rauhamaa <marko@pacujo.net> - 2014-02-13 16:00 +0200
                                  Re: Working with the set of real numbers Chris Angelico <rosuav@gmail.com> - 2014-02-14 06:25 +1100
                                    Re: Working with the set of real numbers Marko Rauhamaa <marko@pacujo.net> - 2014-02-13 21:47 +0200
                                      Re: Working with the set of real numbers Chris Angelico <rosuav@gmail.com> - 2014-02-14 07:08 +1100
                                      Re: Working with the set of real numbers Devin Jeanpierre <jeanpierreda@gmail.com> - 2014-02-13 22:05 -0800
                                        Re: Working with the set of real numbers Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-02-15 00:30 +1300
                                          Re: Working with the set of real numbers Devin Jeanpierre <jeanpierreda@gmail.com> - 2014-02-14 16:26 -0800
                                      Re: Working with the set of real numbers albert@spenarnc.xs4all.nl (Albert van der Horst) - 2014-03-05 02:38 +0000
                                    Re: Working with the set of real numbers Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-02-14 19:37 +1300
                                      Re: Working with the set of real numbers Chris Angelico <rosuav@gmail.com> - 2014-02-14 17:44 +1100
                                        Re: Working with the set of real numbers Rustom Mody <rustompmody@gmail.com> - 2014-02-14 07:13 -0800
                                      Re: Working with the set of real numbers Dave Angel <davea@davea.name> - 2014-02-14 07:30 -0500
                                      Re: Working with the set of real numbers Grant Edwards <invalid@invalid.invalid> - 2014-02-14 15:09 +0000
                                  Re: Working with the set of real numbers Rotwang <sg552@hotmail.co.uk> - 2014-02-13 21:29 +0000
                                    Re: Working with the set of real numbers Marko Rauhamaa <marko@pacujo.net> - 2014-02-14 00:00 +0200
                                      Re: Working with the set of real numbers Rotwang <sg552@hotmail.co.uk> - 2014-02-13 22:21 +0000
                                        Re: Working with the set of real numbers Marko Rauhamaa <marko@pacujo.net> - 2014-02-14 01:16 +0200
                              Re: Working with the set of real numbers Ben Finney <ben+python@benfinney.id.au> - 2014-02-14 03:57 +1100
                      Re: Finding size of Variable Ned Batchelder <ned@nedbatchelder.com> - 2014-02-10 10:02 -0500
                      Re: Finding size of Variable Neil Cerutti <neilc@norwich.edu> - 2014-02-11 14:29 +0000
          Re: Finding size of Variable Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-02-05 22:14 -0500
        Re: Finding size of Variable Dave Angel <davea@davea.name> - 2014-02-05 08:43 -0500
          Re: Finding size of Variable Ayushi Dalmia <ayushidalmia2604@gmail.com> - 2014-02-05 06:33 -0800
            Re: Finding size of Variable Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-02-05 15:22 +0000

Page 5 of 8 — ← Prev page 1 2 3 4 [5] 6 7 8  Next page →


#67778 — Re: Working with the set of real numbers (was: Finding size of Variable)

Fromalbert@spenarnc.xs4all.nl (Albert van der Horst)
Date2014-03-05 02:27 +0000
SubjectRe: Working with the set of real numbers (was: Finding size of Variable)
Message-ID<53168ba7$0$25064$e4fe514c@dreader37.news.xs4all.nl>
In reply to#67662
In article <mailman.7702.1393932047.18130.python-list@python.org>,
Ian Kelly  <ian.g.kelly@gmail.com> wrote:
>On Mon, Mar 3, 2014 at 11:35 PM, Chris Angelico <rosuav@gmail.com> wrote:
>> In constant space, that will produce the sum of two infinite sequences
>> of digits. (And it's constant time, too, except when it gets a stream
>> of nines. Adding three thirds together will produce an infinite loop
>> as it waits to see if there'll be anything that triggers an infinite
>> cascade of carries.) Now, if there's a way to do that for square
>> rooting a number, then the CF notation has a distinct benefit over the
>> decimal expansion used here. As far as I know, there's no simple way,
>> in constant space and/or time, to progressively yield more digits of a
>> number's square root, working in decimal.
>
>The code for that looks like this:
>
>def cf_sqrt(n):
>    """Yield the terms of the square root of n as a continued fraction."""
>   m = 0
>    d = 1
>    a = a0 = floor_sqrt(n)
>    while True:
>        yield a
>        next_m = d * a - m
>        next_d = (n - next_m * next_m) // d
>        if next_d == 0:
>            break
>        next_a = (a0 + next_m) // next_d
>        m, d, a = next_m, next_d, next_a
>
>
>def floor_sqrt(n):
>    """Return the integer part of the square root of n."""
>    n = int(n)
>    if n == 0: return 0
>    lower = 2 ** int(math.log(n, 2) // 2)
>    upper = lower * 2
>    while upper - lower > 1:
>        mid = (upper + lower) // 2
>        if n < mid * mid:
>            upper = mid
>        else:
>            lower = mid
>    return lower
>
>
>The floor_sqrt function is merely doing a simple binary search and
>could probably be optimized, but then it's only called once during
>initialization anyway.  The meat of the loop, as you can see, is just
>a constant amount of integer arithmetic.  If it were desired to halt
>once the continued fraction starts to repeat, that would just be a
>matter of checking whether the triple (m, d, a) has been seen already.
>
>Going back to your example of adding generated digits though, I don't
>know how to add two continued fractions together without evaluating
>them.

That is highly non-trivial indeed. See the gosper.txt reference
I gave in another post.

Groetjes Albert
-- 
Albert van der Horst, UTRECHT,THE NETHERLANDS
Economic growth -- being exponential -- ultimately falters.
albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst

[toc] | [prev] | [next] | [standalone]


#67663 — Re: Working with the set of real numbers (was: Finding size of Variable)

FromIan Kelly <ian.g.kelly@gmail.com>
Date2014-03-04 04:23 -0700
SubjectRe: Working with the set of real numbers (was: Finding size of Variable)
Message-ID<mailman.7703.1393932233.18130.python-list@python.org>
In reply to#67647
On Tue, Mar 4, 2014 at 4:19 AM, Ian Kelly <ian.g.kelly@gmail.com> wrote:
> def cf_sqrt(n):
>     """Yield the terms of the square root of n as a continued fraction."""
>    m = 0
>     d = 1
>     a = a0 = floor_sqrt(n)
>     while True:
>         yield a
>         next_m = d * a - m
>         next_d = (n - next_m * next_m) // d
>         if next_d == 0:
>             break
>         next_a = (a0 + next_m) // next_d
>         m, d, a = next_m, next_d, next_a

Sorry, all that "next" business is totally unnecessary.  More simply:

def cf_sqrt(n):
    """Yield the terms of the square root of n as a continued fraction."""
    m = 0
    d = 1
    a = a0 = floor_sqrt(n)
    while True:
        yield a
        m = d * a - m
        d = (n - m * m) // d
        if d == 0:
            break
        a = (a0 + m) // d

[toc] | [prev] | [next] | [standalone]


#67781 — Re: Working with the set of real numbers (was: Finding size of Variable)

Fromalbert@spenarnc.xs4all.nl (Albert van der Horst)
Date2014-03-05 02:15 +0000
SubjectRe: Working with the set of real numbers (was: Finding size of Variable)
Message-ID<531688b1$0$25064$e4fe514c@dreader37.news.xs4all.nl>
In reply to#67631
In article <mailman.7687.1393902132.18130.python-list@python.org>,
Chris Angelico  <rosuav@gmail.com> wrote:
>On Tue, Mar 4, 2014 at 1:45 PM, Albert van der Horst
><albert@spenarnc.xs4all.nl> wrote:
>>>No, the Python built-in float type works with a subset of real numbers:
>>
>> To be more precise: a subset of the rational numbers, those with a denominator
>> that is a power of two.
>
>And no more than N bits (53 in a 64-bit float) in the numerator, and
>the denominator between the limits of the exponent. (Unless it's
>subnormal. That adds another set of small numbers.) It's a pretty
>tight set of restrictions, and yet good enough for so many purposes.
>
>But it's a far cry from "all real numbers". Even allowing for
>continued fractions adds only some more; I don't think you can
>represent surds that way.

Adding cf's adds all computable numbers in infinite precision.
However that is not even a drop in the ocean, as the computable
numbers have measure zero.
A cf object yielding its coefficients amounts to a program that generates
an infinite amount of data (in infinite time), so it is not
very surprising it can represent any computable number.

Pretty humbling really.

>
>ChrisA

Groetjes Albert
-- 
Albert van der Horst, UTRECHT,THE NETHERLANDS
Economic growth -- being exponential -- ultimately falters.
albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst

[toc] | [prev] | [next] | [standalone]


#67787 — Re: Working with the set of real numbers (was: Finding size of Variable)

FromSteven D'Aprano <steve@pearwood.info>
Date2014-03-05 03:41 +0000
SubjectRe: Working with the set of real numbers (was: Finding size of Variable)
Message-ID<53169cd9$0$2923$c3e8da3$76491128@news.astraweb.com>
In reply to#67781
On Wed, 05 Mar 2014 02:15:14 +0000, Albert van der Horst wrote:

> Adding cf's adds all computable numbers in infinite precision. However
> that is not even a drop in the ocean, as the computable numbers have
> measure zero.

On the other hand, it's not really clear that the non-computable numbers 
are useful or necessary for anything. They exist as mathematical 
abstractions, but they'll never be the result of any calculation or 
measurement that anyone might do.



-- 
Steven

[toc] | [prev] | [next] | [standalone]


#67795 — Re: Working with the set of real numbers (was: Finding size of Variable)

FromRustom Mody <rustompmody@gmail.com>
Date2014-03-04 20:15 -0800
SubjectRe: Working with the set of real numbers (was: Finding size of Variable)
Message-ID<c39d5b44-6c7b-40d1-bbb5-791a36af6857@googlegroups.com>
In reply to#67787
On Wednesday, March 5, 2014 9:11:13 AM UTC+5:30, Steven D'Aprano wrote:
> On Wed, 05 Mar 2014 02:15:14 +0000, Albert van der Horst wrote:

> > Adding cf's adds all computable numbers in infinite precision. However
> > that is not even a drop in the ocean, as the computable numbers have
> > measure zero.

> On the other hand, it's not really clear that the non-computable numbers 
> are useful or necessary for anything. They exist as mathematical 
> abstractions, but they'll never be the result of any calculation or 
> measurement that anyone might do.

There are even more extreme versions of this amounting to roughly this view:
"Any infinity supposedly 'larger' than the natural numbers is a nonsensical notion."

See eg
http://en.wikipedia.org/wiki/Controversy_over_Cantor%27s_theory

and Weyl/Polya bet (pg 10 of http://research.microsoft.com/en-us/um/people/gurevich/Opera/123.pdf )

I cannot find the exact quote so from memory Weyl says something to this effect:

Cantor's diagonalization PROOF is not in question.
Its CONCLUSION very much is.
The classical/platonic mathematician (subject to wooly thinking) concludes that 
the real numbers are a superset of the integers

The constructvist mathematician (who supposedly thinks clearly) only concludes
the obvious, viz that real numbers cannot be enumerated

To go from 'cannot be enumerated' to 'is a proper superset of' requires the 
assumption of 'completed infinities' and that is not math but theology

[toc] | [prev] | [next] | [standalone]


#67796 — Re: Working with the set of real numbers (was: Finding size of Variable)

FromRoy Smith <roy@panix.com>
Date2014-03-04 23:25 -0500
SubjectRe: Working with the set of real numbers (was: Finding size of Variable)
Message-ID<roy-38F1BC.23253704032014@news.panix.com>
In reply to#67795
In article <c39d5b44-6c7b-40d1-bbb5-791a36af6857@googlegroups.com>,
 Rustom Mody <rustompmody@gmail.com> wrote:

> I cannot find the exact quote so from memory Weyl says something to this 
> effect:
> 
> Cantor's diagonalization PROOF is not in question.
> Its CONCLUSION very much is.
> The classical/platonic mathematician (subject to wooly thinking) concludes 
> that 
> the real numbers are a superset of the integers
> 
> The constructvist mathematician (who supposedly thinks clearly) only 
> concludes
> the obvious, viz that real numbers cannot be enumerated
> 
> To go from 'cannot be enumerated' to 'is a proper superset of' requires the 
> assumption of 'completed infinities' and that is not math but theology

I stopped paying attention to mathematicians when they tried to convince 
me that the sum of all natural numbers is -1/12.  Sure, you can 
manipulate the symbols in a way which is consistent with some set of 
rules that we believe govern the legal manipulation of symbols, but it 
just plain doesn't make sense.

[toc] | [prev] | [next] | [standalone]


#67800 — Re: Working with the set of real numbers

FromBen Finney <ben+python@benfinney.id.au>
Date2014-03-05 15:37 +1100
SubjectRe: Working with the set of real numbers
Message-ID<mailman.7792.1393994283.18130.python-list@python.org>
In reply to#67796
Roy Smith <roy@panix.com> writes:

> I stopped paying attention to mathematicians when they tried to convince 
> me that the sum of all natural numbers is -1/12.

I stopped paying attention to a particular person when they said “I
stopped paying attention to an entire field of study because one
position expressed by some practicioners was disagreeable to me”.

Would you think “I stopped listening to logicians when some of them
expressed Zeno's paradox of the impossibility of motion” to be a good
justification for ignoring the entire field of logic?

Rather, a more honest response is to say why that position is incorrect,
and not dismiss the entire field of study merely for a disagreement with
that position.

-- 
 \      “Life does not cease to be funny when people die any more than |
  `\  it ceases to be serious when people laugh.” —George Bernard Shaw |
_o__)                                                                  |
Ben Finney

[toc] | [prev] | [next] | [standalone]


#67802 — Re: Working with the set of real numbers

FromRustom Mody <rustompmody@gmail.com>
Date2014-03-04 20:57 -0800
SubjectRe: Working with the set of real numbers
Message-ID<deb5b4f8-9453-4ed3-84fe-571fd1796d51@googlegroups.com>
In reply to#67800
On Wednesday, March 5, 2014 10:07:44 AM UTC+5:30, Ben Finney wrote:
> Roy Smith writes:

> > I stopped paying attention to mathematicians when they tried to convince 
> > me that the sum of all natural numbers is -1/12.

> I stopped paying attention to a particular person when they said "I
> stopped paying attention to an entire field of study because one
> position expressed by some practicioners was disagreeable to me".

In general this is a correct response
In this particular case (apart from Roy speaking tongue-in-cheek)
it (Roy's viewpoint) is more appropriate and central to our field than you
perhaps realize:

Nonsensical results believed in by a small minority (Cantor's time)
became full scale war between platonists (Hilbert) and constructivists
(Brouwer) a generation later.

Gödel staunchly in Hilbert camp made his incompleteness theorem to rebut the
constructivists

Turing unable to disagree with Gödel's result but disagreeing with platonic
philosophy made his 'machine'. The negative result that he did not like but
had to admit was uncomputability/undecidability. However he trumped Gödel in
making a 'universal' machine

And so we are here :-)

[toc] | [prev] | [next] | [standalone]


#67804 — Re: Working with the set of real numbers

FromRoy Smith <roy@panix.com>
Date2014-03-05 00:29 -0500
SubjectRe: Working with the set of real numbers
Message-ID<roy-778104.00294305032014@news.panix.com>
In reply to#67800
In article <mailman.7792.1393994283.18130.python-list@python.org>,
 Ben Finney <ben+python@benfinney.id.au> wrote:

> Roy Smith <roy@panix.com> writes:
> 
> > I stopped paying attention to mathematicians when they tried to convince 
> > me that the sum of all natural numbers is -1/12.
> 
> I stopped paying attention to a particular person when they said “I
> stopped paying attention to an entire field of study because one
> position expressed by some practicioners was disagreeable to me”.
> 
> Would you think “I stopped listening to logicians when some of them
> expressed Zeno's paradox of the impossibility of motion” to be a good
> justification for ignoring the entire field of logic?
> 
> Rather, a more honest response is to say why that position is incorrect,
> and not dismiss the entire field of study merely for a disagreement with
> that position.

I *was* partly joking (but only partly).

Still, there's lots of stuff mathematicians do which I don't understand.  
I cannot understand, for example, Andrew's Wiles's proof of Fermat's 
Last Theorm.  I can't even get past the first few paragraphs of the 
Wikipedia article.  But, that doesn't sour me on the proof.  I can 
accept that there are things I don't understand.  I don't know how to 
speak Chinese.  I don't know how to paint a flower.  I don't know how to 
run a mile in 4 minutes.  But I accept that there are people who do know 
how to do those things.

I can watch a friend pick up a piece of paper, a brush, and some 
watercolors and 5 minutes later, she's got a painting of a flower.  I 
watched her hands hold the brush and move it over the paper.  There's 
nothing mystical about what she did.  Her hands made no motions which 
are fundamentally impossible for my hands to make, yet I know that my 
attempt at reproducing her work would not result in a painting of a 
flower.

But, as I watch the -1/12 proof unfold, I don't get the same feeling.  I 
understand every step.  I wouldn't have thought to manipulate the 
symbols that way, but once I've seen it done, I can reproduce the steps 
myself.  It's all completely understandable.  The only problem is, it 
results in a conclusion which makes no sense.  I can *prove* that it 
makes no sense, by manipulating the symbols in different ways.  The sum 
of any two positive numbers must be positive.  I can group them and add 
them up any way I want and that's still true.

But, here I've got some guy telling me it's not true.  If you just slide 
this over that way, and add these parts up this way, it's -1/12.  That 
does not compute.  But it doesn't not compute in the sense of, "that's 
so complicated, I have no idea what you did", but in the sense of "thats 
so simple, I know exactly what you did, and it's bullshit" :-)

[toc] | [prev] | [next] | [standalone]


#67820 — Re: Working with the set of real numbers (was: Finding size of Variable)

FromSteven D'Aprano <steve@pearwood.info>
Date2014-03-05 07:52 +0000
SubjectRe: Working with the set of real numbers (was: Finding size of Variable)
Message-ID<5316d7a0$0$2923$c3e8da3$76491128@news.astraweb.com>
In reply to#67796
On Tue, 04 Mar 2014 23:25:37 -0500, Roy Smith wrote:

> I stopped paying attention to mathematicians when they tried to convince
> me that the sum of all natural numbers is -1/12.  

I'm pretty sure they did not. Possibly a physicist may have tried to tell 
you that, but most mathematicians consider physicists to be lousy 
mathematicians, and the mere fact that they're results seem to actually 
work in practice is an embarrassment for the entire universe. A 
mathematician would probably have said that the sum of all natural 
numbers is divergent and therefore there is no finite answer.

Well, that is, apart from mathematicians like Euler and Ramanujan. When 
people like them tell you something, you better pay attention.

We have an intuitive understanding of the properties of addition. You 
can't add 1000 positive whole numbers and get a negative fraction, that's 
obvious. But that intuition only applies to *finite* sums. They don't 
even apply to infinite *convergent* series, and they're *easy*. Remember 
Zeno's Paradoxes? People doubted that the convergent series:

1/2 + 1/4 + 1/8 + 1/16 + ... 

added up to 1 for the longest time, even though they could see with their 
own eyes that it had to. Until they worked out what *infinite* sums 
actually meant, their intuitions were completely wrong. This is a good 
lesson for us all.

The sum of all the natural numbers is a divergent infinite series, so we 
shouldn't expect that our intuitions hold. We can't add it up as if it 
were a convergent series, because it's not convergent. Nobody disputes 
that. But perhaps there's another way?

Normally mathematicians will tell you that divergent series don't have a 
total. That's because often the total you get can vary depending on how 
you add them up. The classic example is summing the infinite series:

1 - 1 + 1 - 1 + 1 - ... 

Depending on how you group them, you can get:

(1 - 1) + (1 - 1) + (1 - 1) ...  
= 0 + 0 + 0 + ... = 0

or you can get:

1 - (1 - 1 + 1 - 1 + ... ) 
= 1 - (1 - 1) - (1 - 1) - ... )
= 1 - 0 - 0 - 0 ... 
= 1

Or you can do a neat little trick where we define the sum as "x":

x = 1 - 1 + 1 - 1 + 1 - ... 
x = 1 - (1 - 1 + 1 - 1 + ... )
x = 1 - x
2x = 1
x = 1/2


So at first glance, summing a divergent series is like dividing by zero. 
You get contradictory results, at least in this case.

But that's not necessarily always the case. You do have to be careful 
when summing divergent series, but that doesn't always mean you can't do 
it and get a meaningful answer. Sometimes you can, sometimes you can't, 
it depends on the specific series. With the sum of the natural numbers, 
rather than getting three different results from three different methods, 
mathematicians keep getting the same -1/12 result using various methods. 
That's a good hint that there is something logically sound going on here, 
even if it seems unintuitive.

Remember Zeno's Paradoxes? Our intuitions about equality and plus and 
sums of numbers don't apply to infinite series. We should be at least 
open to the possibility that while all the *finite* sums:

1 + 2
1 + 2 + 3
1 + 2 + 3 + 4
...

and so on sum to positive whole numbers, that doesn't mean that the 
*infinite* sum has to total to a positive whole number. Maybe that's not 
how addition works. I don't know about you, but I've never personally 
added up an infinite number of every-increasing quantities to see what 
the result is. Maybe it is a negative fraction. (I'd say "try it and 
see", but I don't have an infinite amount of time to spend on it.)

And in fact that's exactly what seems to be case here. Mathematicians can 
demonstrate an identity (that is, equality) between the divergent sum of 
the natural numbers with the zeta function ζ(-1), and *that* can be 
worked out independently, and equals -1/12.

So there are a bunch of different ways to show that the divergent sum 
adds up to -1/12, some of them are more vigorous than others. The zeta 
function method is about as vigorous as they come. The addition of an 
infinite number of things behaves differently than the addition of finite 
numbers of things.

More here:

http://scitation.aip.org/content/aip/magazine/physicstoday/news/10.1063/PT.5.8029

http://math.ucr.edu/home/baez/week126.html

http://en.wikipedia.org/wiki/1_+_2_+_3_+_4_+_%E2%8B%AF

and even here:

http://scientopia.org/blogs/goodmath/2014/01/20/oy-veh-power-series-analytic-continuations-and-riemann-zeta/

where a mathematician tries *really hard* to discredit the idea that the 
sum equals -1/12, but ends up proving that it does. So he simply plays a 
linguistic slight of hand and claims that despite the series and the zeta 
function being equal, they're not *actually* equal.

In effect, the author Mark Carrol-Chu in the "GoodMath" blog above wants 
to make the claim that the divergent sum is not equal to ζ(-1), but 
everywhere you find that divergent sum in your calculations you can rub 
it out and replace it with ζ(-1), which is -1/12. In other words, he's 
accepting that the divergent sum behaves *as if* it were equal to -1/12, 
he just doesn't want to say that it *is* equal to -1/12.

Is this a mere semantic trick, or a difference of deep and fundamental 
importance? Mark C-C thinks it's an important difference. Mathematicians 
who actually work on this stuff all the time think he's making a semantic 
trick to avoid facing up to the fact that sums of infinite sequences 
don't always behave like sums of finite sequences.



-- 
Steven

[toc] | [prev] | [next] | [standalone]


#67824 — Re: Working with the set of real numbers (was: Finding size of Variable)

FromSteven D'Aprano <steve@pearwood.info>
Date2014-03-05 08:38 +0000
SubjectRe: Working with the set of real numbers (was: Finding size of Variable)
Message-ID<5316e278$0$2923$c3e8da3$76491128@news.astraweb.com>
In reply to#67820
Following up on my own post.

On Wed, 05 Mar 2014 07:52:01 +0000, Steven D'Aprano wrote:

> On Tue, 04 Mar 2014 23:25:37 -0500, Roy Smith wrote:
> 
>> I stopped paying attention to mathematicians when they tried to
>> convince me that the sum of all natural numbers is -1/12.
[...]
> In effect, the author Mark Carrol-Chu in the "GoodMath" blog above wants
> to make the claim that the divergent sum is not equal to ζ(-1), but
> everywhere you find that divergent sum in your calculations you can rub
> it out and replace it with ζ(-1), which is -1/12. In other words, he's
> accepting that the divergent sum behaves *as if* it were equal to -1/12,
> he just doesn't want to say that it *is* equal to -1/12.
> 
> Is this a mere semantic trick, or a difference of deep and fundamental
> importance? Mark C-C thinks it's an important difference. Mathematicians
> who actually work on this stuff all the time think he's making a
> semantic trick to avoid facing up to the fact that sums of infinite
> sequences don't always behave like sums of finite sequences.

Here's another mathematician who is even more explicit about what she's 
complaining about:

http://blogs.scientificamerican.com/roots-of-unity/2014/01/20/is-the-sum-of-positive-integers-negative/

    [quote]
    There is a meaningful way to associate the number -1/12 to the 
    series 1+2+3+4…, but in my opinion, it is misleading to call 
    it the sum of the series.
    [end quote]

Evelyn Lamb's objection isn't about the mathematics that leads to the 
conclusion that the sum of natural numbers is equivalent to -1/12. That's 
conclusion is pretty much bulletproof. Her objection is over the use of 
the word "equals" to describe that association. Or possibly the use of 
the word "sum" to describe what we're doing when we replace the infinite 
series with -1/12.

Whatever it is that we're doing, it doesn't seem to have the same 
behavioural properties as summing finitely many finite numbers. So 
perhaps she is right, and we shouldn't call the sum of a divergent series 
a sum?


-- 
Steven

[toc] | [prev] | [next] | [standalone]


#67827 — Re: Working with the set of real numbers (was: Finding size of Variable)

Fromwxjmfauth@gmail.com
Date2014-03-05 01:00 -0800
SubjectRe: Working with the set of real numbers (was: Finding size of Variable)
Message-ID<a3a15dce-69ba-41bc-89cd-21b84be35627@googlegroups.com>
In reply to#67824
Mathematics?
The Flexible String Representation is a very nice example
of a mathematical absurdity.

jmf

PS Do not even think to expect to contradict me. Hint:
sheet of paper and pencil.

[toc] | [prev] | [next] | [standalone]


#67831 — Re: Working with the set of real numbers

FromNed Batchelder <ned@nedbatchelder.com>
Date2014-03-05 06:23 -0500
SubjectRe: Working with the set of real numbers
Message-ID<mailman.7809.1394018630.18130.python-list@python.org>
In reply to#67827
On 3/5/14 4:00 AM, wxjmfauth@gmail.com wrote:
> Mathematics?
> The Flexible String Representation is a very nice example
> of a mathematical absurdity.
>
> jmf
>
> PS Do not even think to expect to contradict me. Hint:
> sheet of paper and pencil.
>

Reminder to everyone: JMF makes no sense when he talks about the FSR, 
and absurdly seems to think hinting at paper and pencil will convince us 
he is right.  Don't engage with him on this topic.

-- 
Ned Batchelder, http://nedbatchelder.com

[toc] | [prev] | [next] | [standalone]


#67839 — Re: Working with the set of real numbers (was: Finding size of Variable)

FromOscar Benjamin <oscar.j.benjamin@gmail.com>
Date2014-03-05 12:21 +0000
SubjectRe: Working with the set of real numbers (was: Finding size of Variable)
Message-ID<mailman.7815.1394022463.18130.python-list@python.org>
In reply to#67820
On 5 March 2014 07:52, Steven D'Aprano <steve@pearwood.info> wrote:
> On Tue, 04 Mar 2014 23:25:37 -0500, Roy Smith wrote:
>
>> I stopped paying attention to mathematicians when they tried to convince
>> me that the sum of all natural numbers is -1/12.
>
> I'm pretty sure they did not. Possibly a physicist may have tried to tell
> you that, but most mathematicians consider physicists to be lousy
> mathematicians, and the mere fact that they're results seem to actually
> work in practice is an embarrassment for the entire universe. A
> mathematician would probably have said that the sum of all natural
> numbers is divergent and therefore there is no finite answer.

Why the dig at physicists? I think most physicists would be able to
tell you that the sum of all natural numbers is not -1/12. In fact
most people with very little background in mathematics can tell you
that.

The argument that the sum of all natural numbers comes to -1/12 is
just some kind of hoax. I don't think *anyone* seriously believes it.

> Well, that is, apart from mathematicians like Euler and Ramanujan. When
> people like them tell you something, you better pay attention.

Really? Euler didn't even know about absolutely convergent series (the
point in question) and would quite happily combine infinite series to
obtain a formula.

<snip>
> Normally mathematicians will tell you that divergent series don't have a
> total. That's because often the total you get can vary depending on how
> you add them up. The classic example is summing the infinite series:
>
> 1 - 1 + 1 - 1 + 1 - ...

There is a distinction between absolute convergence and convergence.
Rearranging the order of the terms in the above infinite sum is
invalid because the series is not absolutely convergent. For this
particular series there is no sense in which its sum converges on an
answer but there are other series that cannot be rearranged while
still being convergent:
http://en.wikipedia.org/wiki/Harmonic_series_(mathematics)#Alternating_harmonic_series

Personally I think it's reasonable to just say that the sum of the
natural numbers is infinite rather than messing around with terms like
undefined, divergent, or existence. There is a clear difference
between a series (or any limit) that fails to converge  asymptotically
and another that just goes to +-infinity. The difference is usually
also relevant to any practical application of this kind of maths.


Oscar

[toc] | [prev] | [next] | [standalone]


#67860 — Re: Working with the set of real numbers (was: Finding size of Variable)

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2014-03-05 17:43 +0000
SubjectRe: Working with the set of real numbers (was: Finding size of Variable)
Message-ID<53176225$0$29987$c3e8da3$5496439d@news.astraweb.com>
In reply to#67839
On Wed, 05 Mar 2014 12:21:37 +0000, Oscar Benjamin wrote:

> On 5 March 2014 07:52, Steven D'Aprano <steve@pearwood.info> wrote:
>> On Tue, 04 Mar 2014 23:25:37 -0500, Roy Smith wrote:
>>
>>> I stopped paying attention to mathematicians when they tried to
>>> convince me that the sum of all natural numbers is -1/12.
>>
>> I'm pretty sure they did not. Possibly a physicist may have tried to
>> tell you that, but most mathematicians consider physicists to be lousy
>> mathematicians, and the mere fact that they're results seem to actually
>> work in practice is an embarrassment for the entire universe. A
>> mathematician would probably have said that the sum of all natural
>> numbers is divergent and therefore there is no finite answer.
> 
> Why the dig at physicists? 

There is considerable professional rivalry between the branches of 
science. Physicists tend to look at themselves as the paragon of 
scientific "hardness", and look down at mere chemists, who look down at 
biologists. (Which is ironic really, since the actual difficulty in doing 
good science is in the opposite order. Hundreds of years ago, using quite 
primitive techniques, people were able to predict the path of comets 
accurately. I'd like to see them predict the path of a house fly.) 
According to this "greedy reductionist" viewpoint, since all living 
creatures are made up of chemicals, biology is just a subset of 
chemistry, and since chemicals are made up of atoms, chemistry is 
likewise just a subset of physics.

Physics is the fundamental science, at least according to the physicists, 
and Real Soon Now they'll have a Theory Of Everything, something small 
enough to print on a tee-shirt, which will explain everything. At least 
in principle.

Theoretical physicists who work on the deep, fundamental questions of 
Space and Time tend to be the worst for this reductionist streak. They 
have a tendency to think of themselves as elites in an elite field of 
science. Mathematicians, possibly out of professional jealousy, like to 
look down at physics as mere applied maths.

They also get annoyed that physicists often aren't as vigorous with their 
maths as they should be. The controversy over renormalisation in Quantum 
Electrodynamics (QED) is a good example. When you use QED to try to 
calculate the strength of the electron's electric field, you end up 
trying to sum a lot of infinities. Basically, the interaction of the 
electron's charge with it's own electric field gets larger the more 
closely you look. The sum of all those interactions is a divergent 
series. So the physicists basically cancelled out all the infinities, and 
lo and behold just like magic what's left over gives you the right 
answer. Richard Feynman even described it as "hocus-pocus".

The mathematicians *hated* this, and possibly still do, because it looks 
like cheating. It's certainly not vigorous, at least it wasn't back in 
the 1940s. The mathematicians were appalled, and loudly said "You can't 
do that!" and the physicists basically said "Oh yeah, watch us!" and 
ignored them, and then the Universe had the terribly bad manners to side 
with the physicists. QED has turned out to be *astonishingly* accurate, 
the most accurate physical theory of all time. The hocus-pocus worked.


> I think most physicists would be able to tell
> you that the sum of all natural numbers is not -1/12. In fact most
> people with very little background in mathematics can tell you that.

Ah, but there's the rub. People with *very little* background in 
mathematics will tell you that. People with *a very deep and solid* 
background in mathematics will tell you different, particularly if their 
background is complex analysis. (That's *complex numbers*, not 
"complicated" -- although it is complicated too.)


> The argument that the sum of all natural numbers comes to -1/12 is just
> some kind of hoax. I don't think *anyone* seriously believes it.

You would be wrong. I suggest you read the links I gave earlier. Even the 
mathematicians who complain about describing this using the word "equals" 
don't try to dispute the fact that you can identify the sum of natural 
numbers with ζ(-1), or that ζ(-1) = -1/12. They simply dispute that we 
should describe this association as "equals".

What nobody believes is that the sum of natural numbers is a convergent 
series that sums to -1/12, because it is provably not.

In other words, this is not an argument about the maths. Everyone who 
looks at the maths has to admit that it is sound. It's an argument about 
the words we use to describe this. Is it legitimate to say that the 
infinite sum *equals* -1/12? Or only that the series has the value -1/12? 
Or that we can "associate" (talk about a sloppy, non-vigorous term!) the 
series with -1/12?


>> Well, that is, apart from mathematicians like Euler and Ramanujan. When
>> people like them tell you something, you better pay attention.
> 
> Really? Euler didn't even know about absolutely convergent series (the
> point in question) and would quite happily combine infinite series to
> obtain a formula.

(I note that you avoided criticising Ramanujan's work. Very wise.)

Euler was working on infinite series in the 1700s. There's no doubt that 
his work doesn't meet modern standards of mathematical rigour, but those 
modern standards didn't exist back then. Morris Kline writes of Euler:

    Euler's work lacks rigor, is often ad hoc, and contains blunders, 
    but despite this, his calculations reveal an uncanny ability to 
    judge when his methods might lead to correct results.

http://dept.math.lsa.umich.edu/~krasny/math156_Euler-Kline.pdf

Euler certainly deserves to be in the pantheon of maths demigods, 
possibly the greatest mathematician who ever lived. There is a quip made 
that discoveries in mathematics are usually named after Euler, or the 
first person to discover them after Euler.

Euler also wrote that one should not use the term "sum" to describe the 
total of a divergent series, since that implies regular addition, but 
that one can say that when a divergent series comes from an algebraic 
expression, then the value of the series is the value of the expression 
from which is came. Notice that he carefully avoids using the word 
"equals". (See above URL.)

At one time, Euler summed an infinite series and got -1, from which he 
concluded that -1 was (in some sense) larger than infinity. I don't know 
what justification he gave, but the way I think of it is to take the 
number line from -∞ to +∞ and then bend it back upon itself so that there 
is a single infinity, rather like the projective plane only in a single 
dimension. If you start at zero and move towards increasingly large 
numbers, then like Buzz Lightyear you can go to infinity and beyond:

0 -> 1 -> 10 -> 10000 -> ... ∞ -> ... -10000 -> -10 -> -1 -> 0

In this sense, -1/12 is larger than infinity.

Now of course this is an ad hoc sloppy argument, but I'm not a 
professional mathematician. However I can tell you that it's pretty close 
to what the professional mathematicians and physicists do with negative 
absolute temperatures, and that is rigorous.

http://en.wikipedia.org/wiki/Negative_temperature



[...]
> Personally I think it's reasonable to just say that the sum of the
> natural numbers is infinite rather than messing around with terms like
> undefined, divergent, or existence. There is a clear difference between
> a series (or any limit) that fails to converge  asymptotically and
> another that just goes to +-infinity. The difference is usually also
> relevant to any practical application of this kind of maths.

And this is where you get it exactly backwards. The *practical 
application* comes from physics, where they do exactly what you argue 
against: they associate ζ(-1) with the sum of the natural numbers (see, I 
too can avoid the word "equals" too), and *it works*.



-- 
Steven D'Aprano
http://import-that.dreamwidth.org/

[toc] | [prev] | [next] | [standalone]


#67863 — Re: Working with the set of real numbers (was: Finding size of Variable)

FromChris Angelico <rosuav@gmail.com>
Date2014-03-06 05:01 +1100
SubjectRe: Working with the set of real numbers (was: Finding size of Variable)
Message-ID<mailman.7827.1394042514.18130.python-list@python.org>
In reply to#67860
On Thu, Mar 6, 2014 at 4:43 AM, Steven D'Aprano
<steve+comp.lang.python@pearwood.info> wrote:
> Physics is the fundamental science, at least according to the physicists,
> and Real Soon Now they'll have a Theory Of Everything, something small
> enough to print on a tee-shirt, which will explain everything. At least
> in principle.

Everything is, except what isn't.

That's my theory, and I'm sticking to it!

ChrisA

[toc] | [prev] | [next] | [standalone]


#67864 — Re: Working with the set of real numbers (was: Finding size of Variable)

FromChris Kaynor <ckaynor@zindagigames.com>
Date2014-03-05 10:03 -0800
SubjectRe: Working with the set of real numbers (was: Finding size of Variable)
Message-ID<mailman.7828.1394043041.18130.python-list@python.org>
In reply to#67860

[Multipart message — attachments visible in raw view] — view raw

On Wed, Mar 5, 2014 at 9:43 AM, Steven D'Aprano <
steve+comp.lang.python@pearwood.info> wrote:

> At one time, Euler summed an infinite series and got -1, from which he
> concluded that -1 was (in some sense) larger than infinity. I don't know
> what justification he gave, but the way I think of it is to take the
> number line from -∞ to +∞ and then bend it back upon itself so that there
> is a single infinity, rather like the projective plane only in a single
> dimension. If you start at zero and move towards increasingly large
> numbers, then like Buzz Lightyear you can go to infinity and beyond:
>
> 0 -> 1 -> 10 -> 10000 -> ... ∞ -> ... -10000 -> -10 -> -1 -> 0
>

This makes me think that maybe the universe is using ones or two complement
math (is there a negative zero?)...

Chris

[toc] | [prev] | [next] | [standalone]


#67871 — Re: Working with the set of real numbers (was: Finding size of Variable)

FromGrant Edwards <invalid@invalid.invalid>
Date2014-03-05 19:13 +0000
SubjectRe: Working with the set of real numbers (was: Finding size of Variable)
Message-ID<lf7svs$df2$1@reader1.panix.com>
In reply to#67864
On 2014-03-05, Chris Kaynor <ckaynor@zindagigames.com> wrote:
> On Wed, Mar 5, 2014 at 9:43 AM, Steven D'Aprano <
> steve+comp.lang.python@pearwood.info> wrote:
>
>> At one time, Euler summed an infinite series and got -1, from which he
>> concluded that -1 was (in some sense) larger than infinity. I don't know
>> what justification he gave, but the way I think of it is to take the
>> number line from -∞ to +∞ and then bend it back upon itself so that there
>> is a single infinity, rather like the projective plane only in a single
>> dimension. If you start at zero and move towards increasingly large
>> numbers, then like Buzz Lightyear you can go to infinity and beyond:
>>
>> 0 -> 1 -> 10 -> 10000 -> ... ∞ -> ... -10000 -> -10 -> -1 -> 0
>>
>
> This makes me think that maybe the universe is using ones or two complement
> math (is there a negative zero?)...

If the Universe (like most all Python implementations) is using
IEEE-754 floating point, there is.

-- 
Grant Edwards               grant.b.edwards        Yow! This PIZZA symbolizes
                                  at               my COMPLETE EMOTIONAL
                              gmail.com            RECOVERY!!

[toc] | [prev] | [next] | [standalone]


#67881 — Re: Working with the set of real numbers (was: Finding size of Variable)

FromOscar Benjamin <oscar.j.benjamin@gmail.com>
Date2014-03-05 21:22 +0000
SubjectRe: Working with the set of real numbers (was: Finding size of Variable)
Message-ID<mailman.7836.1394054564.18130.python-list@python.org>
In reply to#67860
On 5 March 2014 17:43, Steven D'Aprano
<steve+comp.lang.python@pearwood.info> wrote:
> On Wed, 05 Mar 2014 12:21:37 +0000, Oscar Benjamin wrote:
>>
>> The argument that the sum of all natural numbers comes to -1/12 is just
>> some kind of hoax. I don't think *anyone* seriously believes it.
>
> You would be wrong. I suggest you read the links I gave earlier. Even the
> mathematicians who complain about describing this using the word "equals"
> don't try to dispute the fact that you can identify the sum of natural
> numbers with ζ(-1), or that ζ(-1) = -1/12. They simply dispute that we
> should describe this association as "equals".
>
> What nobody believes is that the sum of natural numbers is a convergent
> series that sums to -1/12, because it is provably not.
>
> In other words, this is not an argument about the maths. Everyone who
> looks at the maths has to admit that it is sound. It's an argument about
> the words we use to describe this. Is it legitimate to say that the
> infinite sum *equals* -1/12? Or only that the series has the value -1/12?
> Or that we can "associate" (talk about a sloppy, non-vigorous term!) the
> series with -1/12?

This is the point. You can "identify" numbers with many different
things. It does not mean to say that the thing is equal to that
number. I can associate the number 2 with my bike since it has 2
wheels. That doesn't mean that the bike is equal to 2.

So the problem with saying that "the sum of the natural numbers equals
-1/12" is precisely as you say with the word "equals" because they're
not equal!

If you restate the conclusion in more accurate (but technical and less
accessible) way that "the analytic continuation of a related set of
convergent series has the value -1/12 at the value that would
correspond to this divergent series" then it becomes less mysterious.
Do I really have to associate the finite negative value found in the
analytic continuation with the sum of the series that is provably
greater than any finite number?

<snip>
>
> At one time, Euler summed an infinite series and got -1, from which he
> concluded that -1 was (in some sense) larger than infinity. I don't know
> what justification he gave, but the way I think of it is to take the
> number line from -∞ to +∞ and then bend it back upon itself so that there
> is a single infinity, rather like the projective plane only in a single
> dimension. If you start at zero and move towards increasingly large
> numbers, then like Buzz Lightyear you can go to infinity and beyond:
>
> 0 -> 1 -> 10 -> 10000 -> ... ∞ -> ... -10000 -> -10 -> -1 -> 0
>
> In this sense, -1/12 is larger than infinity.

There are many examples that appear to show wrapping round from
+infinity to -infinity e.g. the tan function. The thing is that it is
not really "physical" (or meaningful in any direct sense).

So for example I might consider the forces on a particle, apply
Newton's 2nd law and arrive at a differential equation for the
acceleration of the particle, solve the equation and find that the
position of the particle at time t is given by tan(t). This would seem
to imply that as t increases toward pi/2 the particle heads off
infinity miles West but at the exact time pi/2 it wraps around to
reappear at infinity miles East and starts heading back toward its
starting point. The truth is less interesting: the solution tan(t)
becomes invalid at pi/2 and mathematics can tell us nothing about what
happens after that even if all the physics we used was exactly true.

> Now of course this is an ad hoc sloppy argument, but I'm not a
> professional mathematician. However I can tell you that it's pretty close
> to what the professional mathematicians and physicists do with negative
> absolute temperatures, and that is rigorous.
>
> http://en.wikipedia.org/wiki/Negative_temperature

The key point from that page is the sentence "A definition of
temperature can be based on the relationship...".  It is clear that
temperature is a theoretical abstraction. We have intuitive
understandings of what it means but in order for the current body of
thermodynamic theory to be consistent it is necessary to sometimes
give negative values to the temperature. There's nothing unintuitive
about negative temperatures if you understand the usual thermodynamic
definitions of "temperature".

>> Personally I think it's reasonable to just say that the sum of the
>> natural numbers is infinite rather than messing around with terms like
>> undefined, divergent, or existence. There is a clear difference between
>> a series (or any limit) that fails to converge  asymptotically and
>> another that just goes to +-infinity. The difference is usually also
>> relevant to any practical application of this kind of maths.
>
> And this is where you get it exactly backwards. The *practical
> application* comes from physics, where they do exactly what you argue
> against: they associate ζ(-1) with the sum of the natural numbers (see, I
> too can avoid the word "equals" too), and *it works*.

I don't know all the details of what they do there and whether or not
there's a better way of doing it or perhaps a better way of thinking
about the mathematical procedures they apply. (I'm assuming you're
talking about the Casimir effect here).

Let's use a more down to earth example though. Every day from now I'll
give you N pounds where N is the number of days from today. so
tomorrow I'll give you 1 pound, the next day 2 pounds and so on. If
this continues for an infinitely long time then you will have been
given an infinite amount of money. If you phrase the question like
this then I think the professional mathematicians you're referring to
will agree that the sum is infinite.

(It's possible that the money I said I'd send will not materialise. If
you receive a bill for 8 pence you'll know that I was wrong which
should console you for the missing infinite amounts of money).


Oscar

[toc] | [prev] | [next] | [standalone]


#67910 — Re: Working with the set of real numbers (was: Finding size of Variable)

FromRoy Smith <roy@panix.com>
Date2014-03-05 21:31 -0500
SubjectRe: Working with the set of real numbers (was: Finding size of Variable)
Message-ID<roy-3C3E69.21315105032014@news.panix.com>
In reply to#67860
In article <53176225$0$29987$c3e8da3$5496439d@news.astraweb.com>,
 Steven D'Aprano <steve+comp.lang.python@pearwood.info> wrote:

> Physics is the fundamental science, at least according to the physicists, 
> and Real Soon Now they'll have a Theory Of Everything, something small 
> enough to print on a tee-shirt, which will explain everything. At least 
> in principle.

A mathematician, a chemist, and a physicist are arguing the nature of 
prime numbers.  The chemist says, "All odd numbers are prime.  Look, I 
can prove it.  Three is prime.  Five is prime.  Seven is prime".  The 
mathematician says, "That's nonsense.  Nine is not prime".  The 
physicist looks at him and says, "Hmmmm, you may be right, but eleven 
is prime, and thirteen is prime.  It appears that within the limits of 
experimental error, all odd number are indeed prime!"

[toc] | [prev] | [next] | [standalone]


Page 5 of 8 — ← Prev page 1 2 3 4 [5] 6 7 8  Next page →

Back to top | Article view | comp.lang.python


csiph-web