Example #1
0
        /// <summary>
        /// Raises a distribution to a power.
        /// </summary>
        /// <param name="dist">The distribution.</param>
        /// <param name="exponent">The power to raise to.</param>
        /// <returns><paramref name="dist"/> raised to power <paramref name="exponent"/>.</returns>
        public static Gamma operator ^(Gamma dist, double exponent)
        {
            Gamma result = new Gamma();

            result.SetToPower(dist, exponent);
            return(result);
        }
Example #2
0
 /// <summary>
 /// Set this equal to (dist)^exponent
 /// </summary>
 /// <param name="dist"></param>
 /// <param name="exponent"></param>
 public void SetToPower(TruncatedGamma dist, double exponent)
 {
     if (exponent == 0)
     {
         SetToUniform();
     }
     else
     {
         if (exponent < 0 && !((dist.LowerBound == 0) && double.IsPositiveInfinity(dist.UpperBound)))
         {
             throw new DivideByZeroException("The exponent is negative and the bounds are finite");
         }
         LowerBound = dist.LowerBound;
         UpperBound = dist.UpperBound;
         Gamma.SetToPower(dist.Gamma, exponent);
     }
 }