This page is part of the web mail archives of SRFI 70 from before July 7th, 2015. The new archives for SRFI 70 contain all messages, not just those from before July 7th, 2015.
| Date: Wed, 15 Jun 2005 12:25:24 +0800 | From: "Chongkai Zhu" <mathematica@xxxxxxxxx> | | ======= At 2005-06-14, 03:33:33 Aubrey Jaffer wrote: ======= | >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 The x2 value in your example is too large; testing the region between 0.1125 and 0.2. Choosing a smaller x2 gives the expected result: > (limit (lambda (x) (exp (expt x -2))) .1 1e-12) 26.881171418152036e42 | As I understand the problem, a 'limit that treats the procedure as | a "black box" is unsolvable. Extrapolation is a technique used in differential equation solvers and elsewhere. Functions that are "continuously differentiable" can be approximated by (polynomial) Taylor series. So extrapolating these functions by polynomials will work for small enough x2. | Even if you fix this particular counterexample, the new 'limit will | have other counterexamples. The LIMIT procedure needs no modification to work on your example. But the documentation should express the constraint on x2 being smaller than any "feature size" of the function near x1. Can anyone suggest how to word this? | Something similar to the halting-problem. The fundamental limitations to this technique are reached when the truncation error of the number representation becomes comparable to the calculated differences. But the same is true of `/' and some transcendental functions. | 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? NUMBER->STRING and STRING->NUMBER in R5RS: -- procedure: number->string z -- procedure: number->string z radix RADIX must be an exact integer, either 2, 8, 10, or 16. If omitted, RADIX defaults to 10. ... -- procedure: string->number string -- procedure: string->number string radix ... RADIX must be an exact integer, either 2, 8, 10, or 16... If RADIX is not supplied, then the default radix is 10. RATIONALIZE in R3RS: - procedure: rationalize x y - procedure: rationalize x ... With two arguments, `rationalize' produces the rational number with smallest denominator differing from X by no more than Y. With one argument, `rationalize' produces the best rational approximation to X, preserving all of the precision in its representation. http://srfi.schemers.org/srfi-27/srfi-27.html (random-source-make-reals s) -> rand (random-source-make-reals s unit) -> rand ... In case unit is absent it defaults to a reasonably small value (related to the width of the mantissa of an efficient number format). | | 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. SRFI-70 LIMIT is an original numerical algorithm. Although a CAS was used to derive the extrapolation formulas, LIMIT does not use symbolic algebra.