Exemplo n.º 1
0
        public static void Run()
        {
            // initialize matrix.
            Matrix <double> matrix = new[, ]
            {
                { 5.7, 6.7, 6.2, 7 },
                { 6.7, 7.7, 7.2, 11 },
                { 7.7, 8.7, 8.2, 6 },
                { 8.7, 9.7, 9.2, 4 },
                { 9.7, 10.7, 10.2, 2 }
            };

            // choose column which will be mark.
            TableIntervals[] table = { TableIntervals.Xi, TableIntervals.Ni };

            // sets configuration for intervals
            var configIntervals = new ConfigIntervals <double>(matrix, table);

            // calculate matrix with intervals.
            var intervals = new Intervals <double>(configIntervals);

            // gets interval row mean
            intervals.GetIntervalRowMean();

            // gets modal interval
            double modal = intervals.ModalInterval;

            // gets median interval
            double median = intervals.MedianInterval;
        }
Exemplo n.º 2
0
        public void IntervalRowMeanTest_FindsIntervalRowMeanByMatrix5x4WhichReturns7Dot63_AssertMustBeTrue()
        {
            // Arrange
            Matrix <double> matrix = new[, ]
            {
                { 5.7, 6.7, 6.2, 7.0 },
                { 6.7, 7.7, 7.2, 11.0 },
                { 7.7, 8.7, 8.2, 6.0 },
                { 8.7, 9.7, 9.2, 4.0 },
                { 9.7, 10.7, 10.2, 2.0 }
            };

            TableIntervals[] tables = { TableIntervals.Xi, TableIntervals.Ni };

            ConfigIntervals <double> configIntervals = new ConfigIntervals <double>(matrix, tables);
            var          intervals = new Intervals <double>(configIntervals);
            const double expected  = 7.63;

            // Act
            double actual = intervals.GetIntervalRowMean();

            // Assert
            Assert.True(expected - actual < 0.0001);
        }