/// <summary>Realizes a sample function for respective stochastic domain mapper and parameters.</summary>
        /// <param name="iteration">The iteration.</param>
        /// <param name="domainMapper">The domain mapper.</param>
        /// <param name="parameters">The parameters.</param>
        /// <returns></returns>
        public double Realize(int iteration, IStochasticDomainMapper domainMapper, double[] parameters)
        {
            ResetGeneration = (PreviousIteration != iteration);
            if (ResetGeneration)
            {
                ResetSampleGeneration();
            }
            double[] stochasticDomainPoint = domainMapper.Map(parameters);
            var      dw = wu / (double)frequencyIntervals;
            int      i  = 0;
            double   randomCoefficient = 0;

            while (i < frequencyIntervals)
            {
                randomCoefficient += Math.Sqrt(2) * Math.Sqrt(2 * SpectralDensity(dw / 2 + i * dw) * dw) *
                                     (Math.Cos((dw / 2 + i * dw) * stochasticDomainPoint[0] +
                                               phi[i]));
                i++;
            }

            if (randomCoefficient >= .9)
            {
                randomCoefficient = .9;
            }
            else if (randomCoefficient <= -.9)
            {
                randomCoefficient = -.9;
            }

            PreviousIteration = iteration;
            return(MeanValue / (1 + randomCoefficient));
        }
コード例 #2
0
        /// <summary>Realizes the specified iteration based on a stochastic domain mapper and the respective domain parameters.</summary>
        /// <param name="iteration">The iteration.</param>
        /// <param name="domainMapper">The domain mapper.</param>
        /// <param name="parameters">The parameters.</param>
        /// <returns></returns>
        public double Realize(int iteration, IStochasticDomainMapper domainMapper, double[] parameters)
        {
            ResetGeneration = (PreviousIteration != iteration);
            if (ResetGeneration)
            {
                ResetSampleGeneration();
            }
            var stochasticDomainPoint = domainMapper.Map(parameters);

            double[] eigenModesAtPoint = CalculateEigenmodesAtPoint(Xcoordinates, Eigenvectors, stochasticDomainPoint[0]);
            var      value             = KarhunenLoeveFredholm1DSampleGenerator(stochasticDomainPoint, Lambda, eigenModesAtPoint, MeanValue, MidpointMethod, IsGaussian);

            PreviousIteration = iteration;
            return(value);
        }
コード例 #3
0
        public double[] GetDerivative(IStochasticDomainMapper domainMapper, double[] parameters)
        {
            double[] stochasticDomainPoint = domainMapper.Map(parameters);
            var      dk = kupper / (double)frequencyIntervals;

            double[] derivative = { 0, 0 };
            for (int i = 0; i < frequencyIntervals; i++)
            {
                for (int j = 0; j < frequencyIntervals; j++)
                {
                    derivative[0] += -(dk / 2 + i * dk) * Math.Sqrt(2) * (Math.Sqrt(2 * SpectralDensity(dk / 2 + i * dk, dk / 2 + j * dk) * dk) *
                                                                          (Math.Sin((dk / 2 + i * dk) * stochasticDomainPoint[0] + (dk / 2 + j * dk) * stochasticDomainPoint[1] + phi1[i, j])) +
                                                                          Math.Sqrt(2 * SpectralDensity(dk / 2 + i * dk, -(dk / 2 + j * dk)) * dk) *
                                                                          (Math.Sin((dk / 2 + i * dk) * stochasticDomainPoint[0] - (dk / 2 + j * dk) * stochasticDomainPoint[1] + phi2[i, j])));
                    derivative[1] += -(dk / 2 + j * dk) * Math.Sqrt(2) * (Math.Sqrt(2 * SpectralDensity(dk / 2 + i * dk, dk / 2 + j * dk) * dk) *
                                                                          (Math.Sin((dk / 2 + i * dk) * stochasticDomainPoint[0] + (dk / 2 + j * dk) * stochasticDomainPoint[1] + phi1[i, j])) -
                                                                          Math.Sqrt(2 * SpectralDensity(dk / 2 + i * dk, -(dk / 2 + j * dk)) * dk) *
                                                                          (Math.Sin((dk / 2 + i * dk) * stochasticDomainPoint[0] - (dk / 2 + j * dk) * stochasticDomainPoint[1] + phi2[i, j])));
                }
            }

            return(derivative);
        }
コード例 #4
0
        public double Realize(int iteration, IStochasticDomainMapper domainMapper, double[] parameters)
        {
            ResetGeneration = (PreviousIteration != iteration);
            if (ResetGeneration)
            {
                ResetSampleGeneration();
            }
            double[] stochasticDomainPoint = domainMapper.Map(parameters);
            var      dk = kupper / (double)frequencyIntervals;
            double   randomCoefficient = 0;

            for (int i = 0; i < frequencyIntervals; i++)
            {
                for (int j = 0; j < frequencyIntervals; j++)
                {
                    randomCoefficient += Math.Sqrt(2) * (Math.Sqrt(2 * SpectralDensity(dk / 2 + i * dk, dk / 2 + j * dk) * dk) *
                                                         (Math.Cos((dk / 2 + i * dk) * stochasticDomainPoint[0] + (dk / 2 + j * dk) * stochasticDomainPoint[1] + phi1[i, j])) +
                                                         Math.Sqrt(2 * SpectralDensity(dk / 2 + i * dk, -(dk / 2 + j * dk)) * dk) *
                                                         (Math.Cos((dk / 2 + i * dk) * stochasticDomainPoint[0] - (dk / 2 + j * dk) * stochasticDomainPoint[1] + phi2[i, j])));
                }
            }

            return(randomCoefficient);
        }