private SistemaLinear.SistemaLinear ObterSistemaLinear(int numeroDePontos, MetodoCoeficientesDosMomentos metodoCoeficientesDosMomentos, double[] pesos, double[] abscissas, Integral.Funcao funcaoDeltaAbscissas, TermoFonteDQMoM termoFonteSistemaLinearDqmoM, DecoradorDePesos decorarPesos, DecoradorDeAbscissas decorarAbscissas, double tempo) { double[,] matrizDeCoeficientes = new double[numeroDePontos, numeroDePontos]; double[] pesosDecorados; double[] abscissasDecoradas; if (decorarPesos != null) pesosDecorados = decorarPesos(pesos, tempo); else pesosDecorados = pesos; if (pesosDecorados == null) pesosDecorados = pesos; if (decorarAbscissas != null) abscissasDecoradas = decorarAbscissas(abscissas, tempo); else abscissasDecoradas = abscissas; if (abscissasDecoradas == null) abscissasDecoradas = abscissas; var resposta = termoFonteSistemaLinearDqmoM(pesosDecorados, abscissasDecoradas, metodoCoeficientesDosMomentos, tempo); if (resposta.Length != numeroDePontos) throw new Exception("Número de pontos deve ser igual na matriz de coeficientes e no termo fonte do DQMoM!"); for (int k = 0; k < numeroDePontos; k++) { for (int i = 0; i < numeroDePontos / 2; i++) { if (funcaoDeltaAbscissas == null) { matrizDeCoeficientes[k, i] = Polinomio(metodoCoeficientesDosMomentos, abscissas[i], k); matrizDeCoeficientes[k, i + numeroDePontos / 2] = pesos[i] * DerivadaPolinomio(metodoCoeficientesDosMomentos, abscissas[i], k); } else { matrizDeCoeficientes[k, i] = Polinomio(metodoCoeficientesDosMomentos, (abscissas[i] + funcaoDeltaAbscissas(abscissas[i])), k); matrizDeCoeficientes[k, i + numeroDePontos / 2] = pesos[i] * DerivadaPolinomio(metodoCoeficientesDosMomentos, (abscissas[i] + funcaoDeltaAbscissas(abscissas[i])), k); } } } SistemaLinear.SistemaLinear sistema = new SistemaLinear.SistemaLinear(matrizDeCoeficientes, resposta); return sistema; }
private void SetVetores() { deltaPesosEAbscissas = new double[numeroDePontos]; matrizDeCoeficientes = new double[numeroDePontos, numeroDePontos]; resposta = new double[numeroDePontos]; sistema = new SistemaLinear.SistemaLinear(matrizDeCoeficientes, resposta); }
private SistemaLinear.SistemaLinear ObterSistemaLinear(double[] y) { double[,] matrizDeCoeficientes = new double[y.Length, y.Length]; for (int i = 0; i < y.Length; i++) { for (int j = 0; j < y.Length; j++) { if (i == j) matrizDeCoeficientes[i, j] = 1.0; else matrizDeCoeficientes[i, j] = 0.0; } } var resposta = TermoFonte(y); SistemaLinear.SistemaLinear sistema = new SistemaLinear.SistemaLinear(matrizDeCoeficientes, resposta); return sistema; }