internal override BaseDistribution InnerGetSumm(BaseDistribution value) { switch (value.InnerDistributionType) { case DistributionType.Number: { return(Mean + value.InnerMean); } case DistributionType.Continious: { return(ContinuousRandomMath.Add((ContinuousDistribution)value, Mean)); } case DistributionType.Discrete: { return(DiscreteRandomMath.Add((DiscreteDistribution)value, Mean)); } default: { throw new DistributionsInvalidOperationException(); } } }
internal override BaseDistribution InnerGetSumm(BaseDistribution value) { switch (value.InnerDistributionType) { case DistributionType.Continious: { var right = (ContinuousDistribution)value; if (BaseDistribution is NormalDistribution && right.BaseDistribution is NormalDistribution) { return(ContinuousRandomMath.ConvolutionOfNormalAndNormal(this, right)); } else if (BaseDistribution is UniformContinuousDistribution && right.BaseDistribution is UniformContinuousDistribution) { return(ContinuousRandomMath.ConvolutionOfUniformAndUniform(this, right)); } else if (BaseDistribution is NormalDistribution && right.BaseDistribution is UniformContinuousDistribution) { return(ContinuousRandomMath.ConvolutionOfNormalAndUniform(this, right)); } else if (BaseDistribution is UniformContinuousDistribution && right.BaseDistribution is NormalDistribution) { return(ContinuousRandomMath.ConvolutionOfNormalAndUniform(right, this)); } else if (BaseDistribution is NormalDistribution && right.BaseDistribution is BhattacharjeeDistribution) { return(ContinuousRandomMath.ConvolutionOfNormalAndBhattacharjee(this, right)); } else if (BaseDistribution is BhattacharjeeDistribution && right.BaseDistribution is NormalDistribution) { return(ContinuousRandomMath.ConvolutionOfNormalAndBhattacharjee(right, this)); } else if (BaseDistribution is StudentGeneralizedDistribution && right.BaseDistribution is UniformContinuousDistribution) { return(ContinuousRandomMath.ConvolutionOfStudentAndUniform(this, right)); } else if (BaseDistribution is UniformContinuousDistribution && right.BaseDistribution is StudentGeneralizedDistribution) { return(ContinuousRandomMath.ConvolutionOfStudentAndUniform(right, this)); } else { return(Discretize() + right.Discretize()); } } case DistributionType.Discrete: { return(Discretize() + value); } case DistributionType.Number: { return(ContinuousRandomMath.Add(this, (double)value)); } default: throw new DistributionsInvalidOperationException(); } }