Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.032 X-Spam-Evidence: '*H*': 0.94; '*S*': 0.00; 'desired.': 0.07; 'linear': 0.09; 'root,': 0.09; 'subject:set': 0.09; 'cc:addr:python-list': 0.11; 'decimal.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'striving': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'producing': 0.19; 'cc:addr:python.org': 0.22; 'space.': 0.24; 'cc:2**0': 0.24; 'asking': 0.27; 'values': 0.27; 'gets': 0.27; 'header:In-Reply-To:1': 0.27; 'wondering': 0.29; 'chris': 0.29; 'am,': 0.29; "doesn't": 0.30; 'message-id:@mail.gmail.com': 0.30; '(which': 0.31; 'about.': 0.31; 'constant': 0.31; 'decimal': 0.31; 'produces': 0.31; 'subject:numbers': 0.31; 'guess': 0.33; 'subject:the': 0.34; 'subject:with': 0.35; 'requirement': 0.35; 'received:google.com': 0.35; 'representing': 0.36; 'yield': 0.36; 'method': 0.36; 'url:org': 0.36; 'rather': 0.38; 'space': 0.40; 'continued': 0.60; 'no.': 0.61; 'simple': 0.61; 'more': 0.64; 'believe': 0.68; 'mar': 0.68; 'obvious': 0.74; 'square': 0.74; 'was:': 0.91; 'to:none': 0.92 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=qzHuhdMcvGPJ7VNf1ZgcbfNWzc9tLCzxDpTREYdIyn4=; b=S8/g8r7pOTxcw3hpIEr9lxbpcy/xTUFDIaR0xADaMCK0jFc78u3jsha1kNkhXhkieA b6pz20WkGKL64gDt06ZsX0UZC6WGQvPwhc3MzTabSUUXde1LUVo6Y4NJKRy+s6sBz+ko 8Z1h+wufFnHd2kLpaAZL7ytxx1TO12fbz/KmHFcKD3cvaG8NJtB69DsUShF2JYBQmPwX 9iyUB9/hApNYDV4AHQ1ZWwDqHXhINJWK7y6jN7GuUqW7/ErpJ7rs4QJ6t0U7/RhZvT4U A8CSHxQkedHSnNrC2M6YOaEK5YRCsHj3IxiPtMrq105wp2LdWgFRq8cNaBBOMtrTLTxd v5dQ== MIME-Version: 1.0 X-Received: by 10.66.118.71 with SMTP id kk7mr1815312pab.14.1393963104196; Tue, 04 Mar 2014 11:58:24 -0800 (PST) In-Reply-To: <87iortoic0.fsf@elektro.pacujo.net> References: <8e4c1ab1-e65d-483f-ad9d-6933ae2052c3@googlegroups.com> <85r478bv99.fsf_-_@benfinney.id.au> <53153e66$0$24931$e4fe514c@dreader36.news.xs4all.nl> <59dd57ad-39b0-4c71-a58e-b4ae6517b385@googlegroups.com> <53156a42$0$2923$c3e8da3$76491128@news.astraweb.com> <87iortoic0.fsf@elektro.pacujo.net> Date: Wed, 5 Mar 2014 06:58:23 +1100 Subject: Re: Working with the set of real numbers From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 23 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1393963107 news.xs4all.nl 2942 [2001:888:2000:d::a6]:54708 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:67713 On Wed, Mar 5, 2014 at 6:49 AM, Marko Rauhamaa wrote: > Chris Angelico : > >> 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. > > I don't know why the constant space/time requirement is crucial. Anyway, > producing more digits simple: . > > I believe producing the nth digit is O(n) in time and space. The reason for striving for constant space/time is because the obvious method (cut-and-try) is already O(n) for the nth digit, which means it's quadratic on the number of digits desired. That gets pretty nasty. So what I was asking was: By representing values as continued fractions rather than as decimal digits, are you able to perform a straight-forward transformation that produces the square root, in constant time (which means linear in the length)? And I guess the answer's no. CF representation doesn't have the advantage I was wondering about. ChrisA