Skip to contents

This function estimates an integral using the Monte Carlo method. It randomly samples `u_ij` values from a uniform distribution and computes the mean of the integrand values for these samples.

Usage

mc_integral(period = c(0, 1), n_samples, y_tilde, v_tilde, tau_tilde)

Arguments

period

Numeric vector, the integration interval, default is `c(0, 1)`.

n_samples

Integer, number of samples to use for the Monte Carlo integration.

y_tilde

Numeric, parameter for the exponential function in the integrand.

v_tilde

Numeric, parameter for the exponential function in the integrand.

tau_tilde

Numeric, parameter for the exponential function in the integrand.

Value

A list containing: - `integral_estimate`: Estimated integral using Monte Carlo. - `time_avg`: Time taken to perform the calculation.