## #2523 Function should approach %e as x approaches infinity.

None
closed
nobody
None
5
2012-12-22
2012-12-22
Lee Reynolds
No

Maxima 5.29.1 compiled on Ubuntu 12.04 x86_64

\$ ./configure --prefix=/usr/local/maxima-5.29.1 --with-cmucl

CMU Common Lisp 20c release-20c (20C Unicode), running on linux
With core: /usr/local/cmucl-20c/lib/cmucl/lib/lisp-sse2.core
Dumped on: Thu, 2011-11-03 01:30:38-07:00 on lorien2
See http://www.cons.org/cmucl/ for support information.
Unicode 1.28 with Unicode version 6.0.0
Python 1.1, target Intel x86/sse2
CLOS based on Gerd's PCL 2010/03/19 15:19:03

```(%i1) f(x) := 1/(1-1/x)^x;
1
(%o1)                          f(x) := --------
1 x
(1 - -)
x
(%i2) numer:true;
(%o2)                                true
(%i3) f(5);
(%o3)                          3.051757812499999
(%i4) f(10);
(%o4)                          2.86797199079244
(%i5) f(100);
(%o5)                          2.731999026429028
(%i6) f(1000);
(%o6)                          2.719642216442853
(%i7) f(10000000);
(%o7)                          2.718281962942588
(%i8) f(1000000000000);
(%o8)                          2.718221696481771
(%i9) f(1000000000000000);
(%o9)                          2.716110034543297
(%i10) f(10000000000000000000);
(%o10)                                1.0
(%i11) f(100000000000000000);
(%o11)                                1.0
(%i12) f(1000000000000000);
(%o12)                         2.716110034543297
(%i13) f(10000000000000000);
(%o13)                         3.035035206941411
(%i14) limit(f(x),x,inf);
(%o14)                                %e
(%i15)
```

Past a certain unknown point, as x gets particularly large, the value of f(x), which should approach %e, deviates and eventually goes off into never never land.

## Discussion

• Lee Reynolds
2012-12-22

I forgot to mention that "make check" completed with 0 unexpected errors.

• Lee Reynolds
2012-12-22

The behavior is identical with Maxima compiled and running on clisp installed via apt-get (with no unexpected errors):

GNU CLISP 2.49 (2010-07-07) (built on allspice.buildd [127.0.1.1])
Software: GNU C 4.6.2
gcc -falign-functions=4 -W -Wswitch -Wcomment -Wpointer-arith -Wimplicit -Wreturn-type -Wmissing-declarations -Wno-sign-compare -Wno-format-nonliteral -O -falign-functions=4 -DENABLE_UNICODE -DDYNAMIC_FFI -DDYNAMIC_MODULES -I. -Wl,-Bsymbolic-functions -Wl,-z,relro -lreadline -lncurses -ldl /usr/lib/libavcall.so /usr/lib/libcallback.so -L/usr/lib -lsigsegv libgnu_cl.a
SAFETY=0 TYPECODES WIDE_HARD GENERATIONAL_GC SPVW_BLOCKS SPVW_MIXED TRIVIALMAP_MEMORY
libsigsegv 2.9
libffcall 1.11
Features:
(READLINE REGEXP SYSCALLS I18N LOOP COMPILER CLOS MOP CLISP ANSI-CL COMMON-LISP LISP=CL INTERPRETER SOCKETS GENERIC-STREAMS
LOGICAL-PATHNAMES SCREEN FFI GETTEXT UNICODE BASE-CHAR=CHARACTER WORD-SIZE=64 PC386 UNIX)
C Modules: (clisp i18n syscalls regexp readline)
Installation directory: /usr/lib/clisp-2.49/
User language: ENGLISH
Machine: X86_64 (X86_64) linux [127.0.1.1]

```Maxima 5.29.1 http://maxima.sourceforge.net
using Lisp CLISP 2.49 (2010-07-07)
Dedicated to the memory of William Schelter.
The function bug_report() provides bug reporting information.

(%i38) fpprec:631285;
(%o38)                              631285
(%i39) float(%pi);
(%o39)                         3.141592653589793
(%i40) f(x) := 1/(1-1/x)^x;
1
(%o40)                         f(x) := --------
1 x
(1 - -)
x
(%i41) f(5);
3125
(%o41)                               ----
1024
(%i42) numer:true;
(%o42)                               true
(%i43) f(5);
(%o43)                         3.051757812499998
(%i44) f(15);
(%o44)                         2.814805238893787
(%i45) f(1000);
(%o45)                         2.719642216442829
(%i46) f(10000);
(%o46)                         2.718417755009753
(%i47) f(100000);
(%o47)                         2.718295419978943
(%i48) f(1000000);
(%o48)                         2.718283187681451
(%i49) f(10000000);
(%o49)                         2.718281963292903
(%i50) f(100000000);
(%o50)                         2.718281852014556
(%i51) f(1000000000);
(%o51)                         2.718281757827628
(%i52) f(10000000000);
(%o52)                         2.718282075183573
(%i53) f(100000000000);
(%o53)                         2.718282065839012
(%i54) f(1000000000000);
(%o54)                         2.718221701110561
(%i55) f(10000000000000);
(%o55)                         2.719127209883344
(%i56) f(100000000000000);
(%o56)                         2.716110047991783
(%i57) f(1000000000000000);
(%o57)                         2.716110034087038
(%i58) f(10000000000000000);
(%o58)                         3.035035206549264
(%i59) f(100000000000000000);
(%o59)                                1.0
```

Last edit: Lee Reynolds 2012-12-22

• Barton Willis
2012-12-22

• Description has changed:

Diff:

```--- old
+++ new
@@ -1,4 +1,3 @@
-
Maxima 5.29.1 compiled on Ubuntu 12.04 x86_64

\$ ./configure --prefix=/usr/local/maxima-5.29.1 --with-cmucl
```
• status: open --> closed

• Barton Willis
2012-12-22

With numer : true, Maxima uses binary64 floating point numbers for calculations. These numbers have about 15 decimal digits. For large x, 1-1/x rounds to 1. Maybe you would like to try the calculation using big floats and a large value for fpprec.