triangle_monte_carlo


triangle_monte_carlo, a Python code which estimates the integral of a function over a general triangle using the Monte Carlo method.

The code makes it easy to vary the triangle over which integration is carried out.

Licensing:

The information on this web page is distributed under the MIT license.

Languages:

triangle_monte_carlo is available in a C version and a C++ version and a Fortran90 version and a MATLAB version and an Octave version and a Python version.

Related Data and Programs:

python_monte_carlo, a Python code which uses Monte Carlo sampling to estimate areas and integrals.

triangle_witherden_rule, a Python code which returns a symmetric Witherden quadrature rule for the triangle, with exactness up to total degree 20.

Reference:

  1. Greg Turk,
    Generating Random Points in a Triangle,
    in Graphics Gems I,
    edited by Andrew Glassner,
    AP Professional, 1990,
    ISBN: 0122861663,
    LC: T385.G697

Source Code:


Last revised on 04 February 2020.