[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

*To*: "Aubrey Jaffer" <agj@xxxxxxxxxxxx>*Subject*: Re: Re: [srfi-70] Limit*From*: "Chongkai Zhu" <mathematica@xxxxxxxxx>*Date*: Wed, 15 Jun 2005 12:25:24 +0800*Cc*: "srfi-70" <srfi-70@xxxxxxxxxxxxxxxxx>*Delivered-to*: srfi-70@xxxxxxxxxxxxxxxxx

======= At 2005-06-14, 03:33:33 Aubrey Jaffer wrote: ======= >That bug has been corrected: > >> (limit (lambda (x) (* -1 x (log x))) 0 1e-9) >102.70578127633066e-12 >> (limit (lambda (x) (* -1 x (log x))) 0 1e-222) >0.0 > >http://savannah.gnu.org/cgi-bin/viewcvs/scm/scm/Transcen.scm?rev=HEAD&content-type=text/vnd.viewcvs-markup >has the new limit code. > >http://swiss.csail.mit.edu/~jaffer/III/Limit.html >explains the mathematics and algorithm. > >The documentation for the new limit procedure is appended. > > | When you try to fix the reference implementation, you will find that > | it cannot be fixed because it comes from the "black box" procedure: > >It took some hard work, but the new limit procedure does treat its >procedure argument as a black box, never calling it at the limit >point. It essentially detects whether the function is convex or >concave near the limit point and uses polynomial extrapolation, either >from the function or its inverse, to estimate the limit value. The >inverse function extrapolation is currently limited to quadratic; >higher order fitting can certainly be done, but the equations get big. > > | Bottom line: In the end, LIMIT might do more harm than it is worth. > | You might want to reconsider if it is a feature that is essential for > | the Scheme programming language itself. > >The new limit procedure works better than I had expected; even >handling a nasty example from an old Macsyma manual (see appended >examples). Arguments that limits are too esoteric or new >counterexamples may yet scuttle them from srfi-70. > A counterexample: > (limit (lambda (x) (exp (expt x -2))) 0.1 0.2) +1/0 > (exp (expt 0.1 -2)) 2.6881171418161084e+043 > (limit (lambda (x) (exp (expt x -2))) 0.1 0.1000001) +1/0 > (limit (lambda (x) (exp (expt x -2))) 0.1 0.1000000001) +1/0 As I understand the problem, a 'limit that treats the procedure as a "black box" is unsolvable. Even if you fix this particular counterexample, the new 'limit will have other counterexamples. Something similar to the halting-problem. The additional argument k itself shows that the 'limit seems un-Scheme-ish. Could you tell another Scheme procedrue (either from R?RS or some other SRFI) that has a similar additional argument? For Computer Algebra Systems, procedures such as 'limit are only supposed to "do right" for daily inputs. But Scheme is requested to be "well-defined" "unambiguous, aesthetically appealing, and consistent specications". Copying something from CASs into Scheme is is both overly ambitious and unnecessary. - Chongkai Zhu The right idea was actually had very early, but somehow didn't win for a long time.

**Follow-Ups**:**Re: [srfi-70] Limit***From:*Aubrey Jaffer

- Prev by Date:
**Re: [srfi-70] Limit** - Next by Date:
**Revision of SRFI 70 available** - Previous by thread:
**LIMIT recommendations** - Next by thread:
**Re: [srfi-70] Limit** - Index(es):