Next: Commutative Rings, Previous: Minimizing, Up: Mathematical Packages [Contents][Index]

- library procedure:
**limit***proc x1 x2 k* - library procedure:
**limit***proc x1 x2* -
`Proc`must be a procedure taking a single inexact real argument.`K`is the number of points on which`proc`will be called; it defaults to 8.If

`x1`is finite, then`Proc`must be continuous on the half-open interval:(

`x1`..`x1`+`x2`]And

`x2`should be chosen small enough so that`proc`is expected to be monotonic or constant on arguments between`x1`and`x1`+`x2`.`Limit`

computes the limit of`proc`as its argument approaches`x1`from`x1`+`x2`.`Limit`

returns a real number or real infinity or ‘`#f`’.If

`x1`is not finite, then`x2`must be a finite nonzero real with the same sign as`x1`; in which case`limit`

returns:`(limit (lambda (x) (proc (/ x))) 0.0 (/`

`x2`)`k`)`Limit`

examines the magnitudes of the differences between successive values returned by`proc`called with a succession of numbers from`x1`+`x2`/`k`to`x1`.If the magnitudes of differences are monotonically decreasing, then then the limit is extrapolated from the degree n polynomial passing through the samples returned by

`proc`.If the magnitudes of differences are increasing as fast or faster than a hyperbola matching at

`x1`+`x2`, then a real infinity with sign the same as the differences is returned.If the magnitudes of differences are increasing more slowly than the hyperbola matching at

`x1`+`x2`, then the limit is extrapolated from the quadratic passing through the three samples closest to`x1`.If the magnitudes of differences are not monotonic or are not completely within one of the above categories, then #f is returned.

;; constant (limit (lambda (x) (/ x x)) 0 1.0e-9) ==> 1.0 (limit (lambda (x) (expt 0 x)) 0 1.0e-9) ==> 0.0 (limit (lambda (x) (expt 0 x)) 0 -1.0e-9) ==> +inf.0 ;; linear (limit + 0 976.5625e-6) ==> 0.0 (limit - 0 976.5625e-6) ==> 0.0 ;; vertical point of inflection (limit sqrt 0 1.0e-18) ==> 0.0 (limit (lambda (x) (* x (log x))) 0 1.0e-9) ==> -102.70578127633066e-12 (limit (lambda (x) (/ x (log x))) 0 1.0e-9) ==> 96.12123142321669e-15 ;; limits tending to infinity (limit + +inf.0 1.0e9) ==> +inf.0 (limit + -inf.0 -1.0e9) ==> -inf.0 (limit / 0 1.0e-9) ==> +inf.0 (limit / 0 -1.0e-9) ==> -inf.0 (limit (lambda (x) (/ (log x) x)) 0 1.0e-9) ==> -inf.0 (limit (lambda (x) (/ (magnitude (log x)) x)) 0 -1.0e-9) ==> -inf.0 ;; limit doesn't exist (limit sin +inf.0 1.0e9) ==> #f (limit (lambda (x) (sin (/ x))) 0 1.0e-9) ==> #f (limit (lambda (x) (sin (/ x))) 0 -1.0e-9) ==> #f (limit (lambda (x) (/ (log x) x)) 0 -1.0e-9) ==> #f ;; conditionally convergent - return #f (limit (lambda (x) (/ (sin x) x)) +inf.0 1.0e222) ==> #f ;; asymptotes (limit / -inf.0 -1.0e222) ==> 0.0 (limit / +inf.0 1.0e222) ==> 0.0 (limit (lambda (x) (expt x x)) 0 1.0e-18) ==> 1.0 (limit (lambda (x) (sin (/ x))) +inf.0 1.0e222) ==> 0.0 (limit (lambda (x) (/ (+ (exp (/ x)) 1))) 0 1.0e-9) ==> 0.0 (limit (lambda (x) (/ (+ (exp (/ x)) 1))) 0 -1.0e-9) ==> 1.0 (limit (lambda (x) (real-part (expt (tan x) (cos x)))) (/ pi 2) 1.0e-9) ==> 1.0 ;; This example from the 1979 Macsyma manual grows so rapidly ;; that x2 must be less than 41. It correctly returns e^2. (limit (lambda (x) (expt (+ x (exp x) (exp (* 2 x))) (/ x))) +inf.0 40) ==> 7.3890560989306504 ;; LIMIT can calculate the proper answer when evaluation ;; of the function at the limit point does not: (tan (atan +inf.0)) ==> 16.331778728383844e15 (limit tan (atan +inf.0) -1.0e-15) ==> +inf.0 (tan (atan +inf.0)) ==> 16.331778728383844e15 (limit tan (atan +inf.0) 1.0e-15) ==> -inf.0 ((lambda (x) (expt (exp (/ -1 x)) x)) 0) ==> 1.0 (limit (lambda (x) (expt (exp (/ -1 x)) x)) 0 1.0e-9) ==> 0.0

Next: Commutative Rings, Previous: Minimizing, Up: Mathematical Packages [Contents][Index]