generate_halton_faure_set: Generate Halton Set (Faure Initialized)

View source: R/generate_values.R

generate_halton_faure_setR Documentation

Generate Halton Set (Faure Initialized)

Description

Generate a set of values from a Faure Halton set.

Usage

generate_halton_faure_set(n, dim)

Arguments

n

The number of values (per dimension) to extract.

dim

The number of dimensions of the sequence.

Value

An 'n' x 'dim' matrix listing all the

Examples

#Generate a 2D sample:
points2d = generate_halton_random_set(n=1000, dim=2)
plot(points2d)

#Extract a separate pair of dimensions
points2d = generate_halton_random_set(n=1000, dim=10)
plot(points2d[,5:6])

#Integrate the value of pi by counting the number of randomly generated points that fall
#within the unit circle.
pointset = matrix(generate_halton_faure_set(10000,dim=2),ncol=2)

pi_estimate = 4*sum(pointset[,1] * pointset[,1] + pointset[,2] * pointset[,2] < 1)/10000
pi_estimate

spacefillr documentation built on May 29, 2024, 7:20 a.m.