Exemplo n.º 1
0
        static List <double> ConductExperiment()
        {
            var uniformGenerator     = new UniformGenerator(9, 10.2, DateTime.Now.Millisecond * 1000);
            var trapezoidalGenerator = new TrapezoidalGenerator(8, 12, 9, 10, DateTime.Now.Millisecond * 1000);
            var discreteGenerator    = new DiscreteGenerator(-0.1, 0.1, 0, 0.1, 0.2, DateTime.Now.Millisecond * 1000);

            var res = new List <double>();

            for (int it1 = 0; it1 < 1000; ++it1)
            {
                var i1  = uniformGenerator.NextRand();
                var i2  = trapezoidalGenerator.NextRand();
                var s   = P * Math.Pow(1 + i1 / 100, N1) * Math.Pow(1 + i2 / 100, N2);
                var h   = 2.6;
                var ksi = 0.0;
                var j   = 1.0;
                for (int it2 = 0; it2 < 16; ++it2)
                {
                    j   *= (1 + (h + ksi) / 100);
                    ksi += discreteGenerator.NextRand();
                    h   += 0.4;
                }
                res.Add(s / j);
            }

            return(res);
        }
Exemplo n.º 2
0
        private void uniformMagicButton_Click(object sender, EventArgs e)
        {
            var A         = (double)uniformANumericUpDown.Value;
            var B         = (double)uniformBNumericUpDown.Value;
            var generator = new UniformGenerator(randomGenerator, A, B);
            var sequence  = new Sequence(generator, SequenceLength);

            ShowValues(sequence, A, B);
        }