ToString() public method

Returns a System.String that represents this instance.
public ToString ( string format, IFormatProvider formatProvider ) : string
format string
formatProvider IFormatProvider
return string
コード例 #1
0
        public void ConstructorTest1()
        {
            var normal = new GeneralizedNormalDistribution(location: 1, scale: 5, shape: 0.42);

            double mean = normal.Mean;     // 1
            double median = normal.Median; // 1
            double mode = normal.Mode;     // 1
            double var = normal.Variance;  // 19200.781700666659

            double cdf = normal.DistributionFunction(x: 1.4); // 0.50877105447218995
            double pdf = normal.ProbabilityDensityFunction(x: 1.4); // 0.024215092283124507
            double lpdf = normal.LogProbabilityDensityFunction(x: 1.4); // -3.7207791921441378

            double ccdf = normal.ComplementaryDistributionFunction(x: 1.4); // 0.49122894552781005
            double icdf = normal.InverseDistributionFunction(p: cdf); // 1.4000000149740104

            double hf = normal.HazardFunction(x: 1.4); // 0.049294921448706883
            double chf = normal.CumulativeHazardFunction(x: 1.4); // 0.71084497569360638

            string str = normal.ToString(CultureInfo.InvariantCulture); // GGD(x; μ = 1, α = 5, β = 0.42)

            Assert.AreEqual(1, mean);
            Assert.AreEqual(1, median);
            Assert.AreEqual(1, mode);
            Assert.AreEqual(19200.781700666659, var);
            Assert.AreEqual(0.71084497569360638, chf);
            Assert.AreEqual(0.50877105447218995, cdf);
            Assert.AreEqual(0.024215092283124507, pdf);
            Assert.AreEqual(-3.7207791921441378, lpdf);
            Assert.AreEqual(0.049294921448706883, hf);
            Assert.AreEqual(0.49122894552781005, ccdf);
            Assert.AreEqual(1.4000000149740104, icdf);
            Assert.AreEqual("GGD(x; μ = 1, α = 5, β = 0.42)", str);
        }
コード例 #2
0
        public void ConstructorTest1()
        {
            var normal = new GeneralizedNormalDistribution(location: 1, scale: 5, shape: 0.42);

            double mean = normal.Mean;     // 1
            double median = normal.Median; // 1
            double mode = normal.Mode;     // 1
            double var = normal.Variance;  // 19200.781700666659

            double cdf = normal.DistributionFunction(x: 1.4); // 0.51076148867681703
            double pdf = normal.ProbabilityDensityFunction(x: 1.4); // 0.024215092283124507
            double lpdf = normal.LogProbabilityDensityFunction(x: 1.4); // -3.7207791921441378

            double ccdf = normal.ComplementaryDistributionFunction(x: 1.4); // 0.48923851132318297
            double icdf = normal.InverseDistributionFunction(p: cdf); // 1.4000000149740108

            double hf = normal.HazardFunction(x: 1.4); // 0.049495474543966168
            double chf = normal.CumulativeHazardFunction(x: 1.4); // 0.7149051552030572

            string str = normal.ToString(CultureInfo.InvariantCulture); // GGD(x; μ = 1, α = 5, β = 0.42)

            Assert.AreEqual(1, mean);
            Assert.AreEqual(1, median);
            Assert.AreEqual(1, mode);
            Assert.AreEqual(19200.781700666659, var);
            Assert.AreEqual(0.7149051552030572, chf);
            Assert.AreEqual(0.51076148867681703, cdf);
            Assert.AreEqual(0.024215092283124507, pdf);
            Assert.AreEqual(-3.7207791921441378, lpdf);
            Assert.AreEqual(0.049495474543966168, hf);
            Assert.AreEqual(0.48923851132318297, ccdf);
            Assert.AreEqual(1.4000000149740108, icdf);
            Assert.AreEqual("GGD(x; μ = 1, α = 5, β = 0.42)", str);

            var range1 = normal.GetRange(0.95);
            var range2 = normal.GetRange(0.99);
            var range3 = normal.GetRange(0.01);

            Assert.AreEqual(-173.60070095277663, range1.Min);
            Assert.AreEqual(175.60070093821949, range1.Max);
            Assert.AreEqual(-428.92857248354409, range2.Min);
            Assert.AreEqual(430.92857248354375, range2.Max);
            Assert.AreEqual(-428.92857248354403, range3.Min);
            Assert.AreEqual(430.92857248354375, range3.Max);
        }