1

Suppose I have a function $f\colon [0,1] \to \mathbb{R}$ which is maybe continuous (it's at least in $L^1$).

I have a sample of $N$ points $\{x_i\}$ taken from the domain $[0,1]$ randomly from some distribution.

I want to be able to calculate $\int_0^1 f$ numerically, to a good degree of accuracy, using as few points as possible, i.e. I want $N$ to be as small as possible.

If I take the points $x_i$ from a random uniform distribution, I can calculate the integral as $$\int_0^1 f = \frac 1N \sum_{i=1}^N f(x_i)$$ (Monte Carlo), but I read online that I need something like $N=10^6$ for this to give an accurate answer.

Is there some other way to have a good result with $N=1000$?

math_guy
  • 111
  • 1
  • 1
    I would start from [here](https://stackoverflow.com/a/17602155/3751931). I used it many times, but tbh I have no idea of the minimum number of points you need in order to have a good approximation – shamalaia Jul 28 '23 at 07:58
  • 1
    You need more assumptions about $f$. A pathological example is f which is zero everywhere except a continuous huge spike at some unknown point. – Valentas Aug 03 '23 at 18:05

0 Answers0