# This function converts n real numbers in the vector zvec to n design weights that each
# lie between 0 and 1, and which sum to 1.
deswtstrig <- function(zvec)
{
term1 <- (sin(zvec))^2
term2 <- cumprod(1 - term1)
deswts <- c(term1,1)*c(1,term2)
deswts
}
# This function converts n design weights (i.e., each between 0 and 1 and summing to 1) in the vector deswts
# to a set of n real numbers z1, ... , zn that generated them. The value of zn is 1.
zvectrig <- function(deswts)
{
s <- length(deswts)
temp <- c(0,deswts[1:(s-2)])
ratios <- deswts[1:(s-1)]/(1-cumsum(temp))
z <- asin(sqrt(ratios))
z
}