예제 #1
0
        private double[] GetGqf(double start, double end, out double[] nodes)
        {
            var moments           = new double[CountOfNodes * 2];
            var bMoments          = new double[CountOfNodes];
            var matrixWithMoments = new double[CountOfNodes][];

            for (var i = 0; i < CountOfNodes * 2; i++)
            {
                moments[i] = CalcWeightFunctionMomentAnalytics(start, end, i);
            }

            for (var i = 0; i < CountOfNodes; i++)
            {
                matrixWithMoments[i] = new double[CountOfNodes];
                for (var j = 0; j < CountOfNodes; j++)
                {
                    matrixWithMoments[i][j] = moments[i + j];
                }

                bMoments[i] = -moments[i + CountOfNodes];
            }

            var lupHelper = new Lup(matrixWithMoments);

            var polynomialCoeff = lupHelper.LesSol(bMoments);

            nodes = GetPolRoot(polynomialCoeff);

            var result = _iqfHelper.GetIqf(start, end, nodes);

            return(result);
        }