3
$\begingroup$

The Mathematica documentation Integrate over Regions gives an example of how to simply integrate over a sphere (surface):

Integrate[1, {x, y, z} ∈ Sphere[]]

Although it seems there is an Hemisphere object in Mathematica, it does not seem possible to easily integrate over all the directions that it includes.

Is there an elegant way to similarly compute the integral of a function over all the directions in an hemisphere?

An example of an application of this would be solving rendering equations

$\endgroup$
6
  • 4
    $\begingroup$ Hemisphere objects in Mathematica are geographical, not geometric region objects. Nonetheless, you can construct more complex regions and use them on Integrate, for instance: Integrate[1, {x, y, z} ∈ RegionIntersection[Sphere[], ImplicitRegion[x > 0, {x, y, z}]]], which takes the parts of the sphere surface where x > 0. $\endgroup$
    – kirma
    Commented Sep 25, 2015 at 4:00
  • 4
    $\begingroup$ ... and in v10.2, you can also use HalfSpace. $\endgroup$
    – kirma
    Commented Sep 25, 2015 at 4:12
  • 2
    $\begingroup$ You referenced an article about hemispheres in MathWorld. Although MathWorld is a Wolfram site, it discussed mathematics, not Mathematica. In particular, the hemisphere it discusses is not a built-in Mathematica object. $\endgroup$
    – m_goldberg
    Commented Sep 25, 2015 at 4:23
  • $\begingroup$ @m_goldberg Thank you, I updated the question. $\endgroup$
    – wip
    Commented Sep 25, 2015 at 6:27
  • 2
    $\begingroup$ @wil My implied intent was that you can use HalfSpace instead of explicitly written ImplicitRegion to specify which hemisphere of Sphere to use. Maybe it even gets treated more efficiently as an abstraction on some future version of Mma! $\endgroup$
    – kirma
    Commented Sep 25, 2015 at 11:13

3 Answers 3

2
$\begingroup$

These drawing and formula can be found in the Global Illumination Compendium (P.15):

Hemisphere parametrization

The integral can therefore be computed as:

Integrate[f[φ, θ] Sin[θ], {φ,0,2π}, {θ, 0, π/2}]
$\endgroup$
2
$\begingroup$

One can do it changing the integrand:

Integrate[1 Boole[x > 0], {x, y, z} ∈ Sphere[]]
$\endgroup$
1
  • 1
    $\begingroup$ Or one can specify the domain completely as a region, just as kirma indicates in the comments to the question. $\endgroup$
    – Michael E2
    Commented Aug 5, 2017 at 19:34
1
$\begingroup$

Edit: Just realized this was in the comments already, but here it is written explicitly:

You can construct the region yourself, e.g.

hemisphere = RegionIntersection[Sphere[],HalfSpace[{-1,0,0},0]];

Then the following will work:

Integrate[1,{x,y,z}\[Element] hemisphere]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.