[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
quad partition
From: |
antonio palestrini |
Subject: |
quad partition |
Date: |
Sat, 23 Dec 2006 01:06:16 +0100 |
Using quad I noted a (known?) funny behavior ...
a bug? .. a numerical problem?
If you integrate exp(-x^2/2), from -10 to 10, you get
[oct 16] [V, IER, NFUN, ERR] = quad ("exp(-x^2 / 2)", -4, 4)
V = 2.50646949857046
IER = 0
NFUN = 63
ERR = 1.21293146751273e-11
good approx of the exact result!
[oct 17] er = (2*pi)^.5
er = 2.50662827463100
[oct 18] V/er
ans = 0.999936657516334
As usual you want to improve the approximation ..
[oct 19] [V, IER, NFUN, ERR] = quad ("exp(-x^2 / 2)", -100, 100)
V = 2.50662827463100
IER = 0
NFUN = 483
ERR = 2.59307801638815e-12
[oct 20] V/er
ans = 1.00000000000000
better!!!!!
continuing ..
[oct 22] [V, IER, NFUN, ERR] = quad ("exp(-x^2 / 2)", -10^4, 10^4)
V = 4.80615650175768e-101
IER = 0
NFUN = 63
ERR = 0
[oct 22] V/er
ans = 1.91737903477738e-101
:-((((((
perhaps the problem is that the partition used to integrate the last stuff is
too rough to find values different from zero ...
The good thing is that using "inf" everything seems fine
[oct 23] [V, IER, NFUN, ERR] = quad ("exp(-x^2 / 2)", -inf, inf)
V = 2.50662827463100
IER = 0
NFUN = 210
ERR = 2.55129423738424e-08
[oct 24] V/er
ans = 1.000000000000000
Why with "inf" the function seems to recognise the relevant part of the support?
A "quad_robust(f(x),a,b)" function have to estimate where in the
support | f(x)| is greater .. has anyone worked (working) on it?
ciao
antonio
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- quad partition,
antonio palestrini <=