# Transform from a simplex to a hypercube

### Description

Transform from a simplex (either regular or right-angled) to a hypercube.

### Usage

 1 2 3 e_to_p(e) p_to_e(p) Jacobian(e) 

### Arguments

 e Vector with all elements between 0 and 1 (hypercube) p Vector of positive elements whose sum is either equal to, or less than, one (simplex)

### Details

Function e_to_p() takes one from e-space to p-space.

Function p_to_e() takes one from p-space to e-space. This is useful when integrating over a simplex; use Jacobian() to evaluate the Jacobian of the transform.

Forward transformation:

e_1=∑_{i=1}^d p_i

e_i=\frac{p_{i-1}}{∑_{j=i-1}^d p_j}, 2 <= i <= d

Backward transformation:

p_1=e_1 e_2

p_i=e_1 e_{i+1} ∏_{i=2}^{i}(1-e_i), 2 <= i <= d

Jacobian:

J=∏_{i=2}^{d-1}(1-e_i)^{d-i}

### Value

The functions documented here return a scalar.

### Note

To do a regular simplex, use the “di” of the right-angled simplex; see the examples.

### Author(s)

Robin K. S. Hankin

### References

• M. Evans and T. Swartz 2000. Approximating Integrals via Monte Carlo and Deterministic Methods, Oxford University Press; page 28

• Robin K. S. Hankin (2010). “A Generalization of the Dirichlet Distribution”, Journal of Statistical Software, 33(11), 1-18, http://www.jstatsoft.org/v33/i11/

dhyperdirichlet
  1 2 3 4 5 6 7 8 9 10 11 ## Not run: # First, try to calculate the volume of a regular 4-simplex: adapt(5,rep(0,5),rep(1,5),functn=function(x){Jacobian(c(1,x))}) # Should be close to 1/5! = 1/120 ~= 0.008333 # (that was the 'di trick') # Now, try to calculate the volume of a triangular-based pyramid: adapt(3,rep(0,3),rep(1,3),functn=Jacobian) # Should be close to 1/8=0.125 ## End(Not run)