Post Reply 
Integration on WP 34S
11-01-2021, 12:16 AM
Post: #2
RE: Integration on WP 34S
(10-31-2021 09:42 PM)lrdheat Wrote:  Question: While the WP 34S does correctly “see” the important part of the function when using 0 to infinity, it, like most of my other calculators, shows “0” if I use an interval of 0 to 40000. Why does it work when using infinity, but fail for large specific numbers?

DE integration algorithm start at the midpoint of two limit, and spread to the edges.
Sample points are then concentrated mostly to the edges.
For f(x) = exp(-x), sample points just underflowed to 0.0

Without underflow issues, it will handle it fine.
Example, mpmath is designed never underflow.

>>> from mpmath import *
>>> quad(exp, (-inf, 0), error=1)
(mpf('1.0'), mpf('1.0e-26'))

If you input limit of 0 to infinity, it does not have a finite top limit.
Points are exponentially spread out toward infinity.

It will not go too far though.
It is really doing two integral at once: \(\displaystyle \int_0^∞ = \int_0^1 + \int_1^∞\)

If the first integral dominates, it will stop the other from going too far.
If this is not the case, it will fail

lua> Q = require'quad'
lua> f = function(x) return exp(-k*x)*k end
lua> k = 1
lua> Q.quad(f, 0, huge)
0.9999999999876823       6.251443807136335e-012       131
lua> k = 1e-3
lua> Q.quad(f, 0, huge)
0.9999999990384378       7.2610534321713e-010       437
lua> k = 1e3
lua> Q.quad(f, 0, huge)
0.028109496544494062       1       31

For k=1e3, all it see is a spike.
It just return gibberish, with estimated error higher than area itself.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Integration on WP 34S - lrdheat - 10-31-2021, 09:42 PM
RE: Integration on WP 34S - Albert Chan - 11-01-2021 12:16 AM



User(s) browsing this thread: 1 Guest(s)