示例#1
0
        public static void CalcularPesosEAbscissas(MetodoCoeficientesDosMomentos metodoCoeficientes, double[] momentos,
            out double[] pesos, out double[] abscissas)
        {
            int numeroDePontos = momentos.Length / 2;

            switch (metodoCoeficientes)
            {
                case MetodoCoeficientesDosMomentos.PDA:
                    AlgoritmoPD algoritmoPd = new AlgoritmoPD(numeroDePontos, momentos);
                    algoritmoPd.CalcularPesosEAbscissas(out pesos, out abscissas);
                    break;
                case MetodoCoeficientesDosMomentos.ChebyShev:
                    var chebyChev = new ChebyshevModificado(numeroDePontos,momentos,ChebyshevModificado.TipoDeDominio.Finito);
                    //var chebyChev = new ChebyshevModificado(momentos, numeroDePontos, ChebyshevModificado.TipoDeDominio.Finito);
                    chebyChev.CalcularPesosEAbscissas(out pesos, out abscissas);
                    break;
                case MetodoCoeficientesDosMomentos.Wheeler:
                    Wheeler wheeler = new Wheeler(numeroDePontos, momentos);
                    wheeler.CalcularPesosEAbscissas(out pesos, out abscissas);
                    break;
                default:
                    throw new ArgumentOutOfRangeException("metodoCoeficientes", metodoCoeficientes, null);
            }
        }
        private void CalcularPesosEAbscissas()
        {
            double[] pf;
            double[] abf;

            var momentos = CalcularMomentosFinais();
            Wheeler wheeler = new Wheeler(momentos.Length / 2, momentos);
            wheeler.CalcularPesosEAbscissas(out pf, out abf);

            double[] pi;
            double[] abi;

            double[] momentosIniciais = new[]
            {
                1.0000000000000000,
                0.7343097109235880,
                0.5502539727012860,
                0.4201449510879860,
                0.3264374407964930,
                0.2577688630354670,
                0.2066322315214840,
                0.1679756057694100,
                0.1383405829521260,
                0.1153216484404730,
                0.0972205496278511,
                0.0828215151094570,
                0.0712427053220418,
                0.0618365584375131,
                0.0541219897678821,
                0.0477376477314290

            };

            wheeler = new Wheeler(momentosIniciais.Length / 2, momentosIniciais);
            wheeler.CalcularPesosEAbscissas(out pi, out abi);

            pesos = new double[pi.Length];
            abscissas = new double[abi.Length];

            pesos = pf;
            abscissas = abf;

            //for (int i = 0; i < pi.Length; i++)
            //{
            //    pesos[i] = (pf[i] + pi[i])/2;
            //    abscissas[i] = (abf[i] + abi[i]) / 2;
            //}

            //Até aqui OK
        }