# SPHERE_INTEGRALS Integrals On the Surface of the Unit Sphere in 3D

SPHERE_INTEGRALS is a C++ library which returns the exact value of the integral of any monomial over the surface of the unit sphere in 3D.

The surface of the unit sphere in 3D is defined by

```        x^2 + y^2 + z^2 = 1
```

The integrands are all of the form

```        f(x,y,z) = x^a y^b z^c
```
where the exponents are nonnegative integers. If any exponent is an odd integer, the integral will be zero. Thus, the "interesting" results occur when all exponents are even.

### Languages:

SPHERE_INTEGRALS is available in a C version and a C++ version and a FORTRAN77 version and a FORTRAN90 version and a MATLAB version and a Python version.

### Related Data and Programs:

BALL_INTEGRALS, a C++ library which returns the exact value of the integral of any monomial over the interior of the unit ball in 3D.

CIRCLE_INTEGRALS, a C++ library which returns the exact value of the integral of any monomial over the surface of the unit circle in 2D.

CUBE_INTEGRALS, a C++ library which returns the exact value of the integral of any monomial over the interior of the unit cube in 3D.

DISK_INTEGRALS, a C++ library which returns the exact value of the integral of any monomial over the interior of the unit disk in 2D.

HYPERBALL_INTEGRALS, a C++ library which returns the exact value of the integral of any monomial over the interior of the unit hyperball in M dimensions.

HYPERCUBE_INTEGRALS, a C++ library which returns the exact value of the integral of any monomial over the interior of the unit hypercube in M dimensions.

HYPERSPHERE_INTEGRALS, a C++ library which returns the exact value of the integral of any monomial over the surface of the unit hypersphere in M dimensions.

LINE_INTEGRALS, a C++ library which returns the exact value of the integral of any monomial over the length of the unit line in 1D.

POLYGON_INTEGRALS, a C++ library which returns the exact value of the integral of any monomial over the interior of a polygon in 2D.

PYRAMID_INTEGRALS, a C++ library which returns the exact value of the integral of any monomial over the interior of the unit pyramid in 3D.

SIMPLEX_INTEGRALS, a C++ library which returns the exact value of the integral of any monomial over the interior of the unit simplex in M dimensions.

SPHERE_MONTE_CARLO, a C++ library which uses the Monte Carlo method to estimate the integral of a function over the surface of the unit sphere in 3D.

SQUARE_INTEGRALS, a C++ library which returns the exact value of the integral of any monomial over the interior of the unit square in 2D.

TETRAHEDRON_INTEGRALS, a C++ library which returns the exact value of the integral of any monomial over the interior of the unit tetrahedron in 3D.

TRIANGLE_INTEGRALS, a C++ library which returns the exact value of the integral of any monomial over the interior of the unit triangle in 2D.

WEDGE_INTEGRALS, a C++ library which returns the exact value of the integral of any monomial over the interior of the unit wedge in 3D.

### List of Routines:

• COS_POWER_INT evaluates the cosine power integral.
• P01_EXACT returns the exact integral of function 1 over the unit sphere.
• P01_F evaluates test function #1 in the unit sphere.
• P01_PARAM sets or gets the value of the parameter for test function 1.
• P01_PARAM_GET gets the value of the parameter for test function 1.
• P01_PARAM_SET sets the parameter for test function 1.
• P02_EXACT returns the exact integral of function 2 over the unit sphere.
• P02_F evaluates test function #2 in the unit sphere.
• P02_PARAM sets or gets the value of the parameter for test function 2.
• P02_PARAM_GET gets the value of the parameter for test function 2.
• P02_PARAM_SET sets the parameter for test function 2.
• P03_EXACT returns the exact integral of function 3 over the unit sphere.
• P03_F evaluates test function #3 in the unit sphere.
• R8_UNIFORM_01 returns a unit pseudorandom R8.
• R8VEC_NORMAL_01_NEW returns a unit pseudonormal R8VEC.
• R8VEC_SUM returns the sum of an R8VEC.
• R8VEC_UNIFORM_01_NEW returns a new unit pseudorandom R8VEC.
• SIN_POWER_INT evaluates the sine power integral.
• SPHERE_UNIT_SAMPLE returns sample points from the unit sphere.
• TIMESTAMP prints the current YMDHMS date as a time stamp.

You can go up one level to the C++ source codes.

Last revised on 06 January 2014.