Errors


Trapeze

explanation on wiki


Simpson

details

explanation on wiki

Alternative Simpson code


Monte carlo

making random numbers with the Golden ratio

https://www.sciencedirect.com/science/article/pii/S0895717707002890

Conclusions

Study of transcendental and algebraic numbers for random sequence sources for randomized algorithms. Our numerical experiment shows that pi () has always scored over phi (the golden ratio) in one-dimensional Monte Carlo integration. This implies that other transcendental numbers as well as algebraic numbers could also be investigated to determine the uniformity/discrepancy of distribution of random numbers generated out of them. This has not only academic interest but also possibly significant real-world applications. However, while quasi-random sequences are better suited for uniform scanning of a space such as that required in Monte Carlo integration, these need not fare better than the pseudo-random sequences for other kinds of problems such as the traveling salesman problem (TSP) [2]. These are because pseudo-random numbers are a bit too random unlike quasi-random numbers. Quasi-random numbers, on the other hand, are more uniformly distributed (with less discrepancy) than pseudo-random numbers.

source

A low-discrepancy sequence is a sequence with the property that for all values of N, its subsequence $x_1, ..., x_N$ has a low discrepancy.

Roughly speaking, the discrepancy of a sequence is low if the proportion of points in the sequence falling into an arbitrary set B is close to proportional to the measure of B, as would happen on average (but not for particular samples) in the case of an equidistributed sequence. Specific definitions of discrepancy differ regarding the choice of B (hyperspheres, hypercubes, etc.) and how the discrepancy for every B is computed (usually normalized) and combined (usually by taking the worst value).

Low-discrepancy sequences are also called quasirandom sequences, due to their common use as a replacement of uniformly distributed random numbers. The "quasi" modifier is used to denote more clearly that the values of a low-discrepancy sequence are neither random nor pseudorandom, but such sequences share some properties of random variables and in certain applications such as the quasi-Monte Carlo method their lower discrepancy is an important advantage.