// Approximate as normal (true if other is Gaussian)
        public override ContinuousDistribution Plus(ContinuousDistribution two)
        {
            return(new GaussianDistribution(mean + two.Mean, variance + two.Variance));

            /*return new GaussianDistribution((mean * two.Variance + two.Mean * variance) / (variance + two.Variance),
             *                              variance * two.Variance / (variance + two.Variance));*/
        }
        public override ContinuousDistribution Plus(ContinuousDistribution two)
        {
            if (two is ClippedGaussianDistribution)
            {
                ClippedGaussianDistribution other = (ClippedGaussianDistribution)two;
                return(new ClippedGaussianDistribution(mean + two.Mean, variance + two.Variance, lower + other.lower, upper + other.upper));
            }

            return(new GaussianDistribution(mean + two.Mean, variance + two.Variance));
        }
Beispiel #3
0
 public TransformedDistribution(ContinuousDistribution distribution, double shift, double scale)
 {
     this.distribution = distribution;
     this.shift        = shift;
     this.scale        = scale;
 }
 public override ContinuousDistribution Times(ContinuousDistribution two)
 {
     return(new GaussianDistribution((mean * two.Variance + two.Mean * variance) / (variance + two.Variance),
                                     variance * two.Variance / (variance + two.Variance)));
 }
 // Approximate as normal-- very poor approximation -- assume far from 0
 public override ContinuousDistribution DividedBy(ContinuousDistribution two)
 {
     return(Times(new GaussianDistribution(1 / two.Mean, two.Variance / (two.Mean * two.Mean))));
 }
 // Approximate as normal (poor approximation) - from (mu1 + s1) * (mu2 + s2)
 public override ContinuousDistribution Times(ContinuousDistribution two)
 {
     return(new GaussianDistribution(mean * two.Mean, Math.Abs(mean) * two.Variance + Math.Abs(two.Mean) * variance));
 }
 public override ContinuousDistribution Times(ContinuousDistribution two)
 {
     return(two);
 }
 public virtual ContinuousDistribution DividedBy(ContinuousDistribution two)
 {
     throw new NotImplementedException();
 }
 public virtual ContinuousDistribution Times(ContinuousDistribution two)
 {
     throw new NotImplementedException();
 }
 public virtual ContinuousDistribution Minus(ContinuousDistribution two)
 {
     return(this.Plus(two.Negate()));
 }