Example #1
0
        public float[] obtenerPolinomioDeLx(float[] xArray, int i, float[] polAnterior)
        {
            Procesamiento_de_datos.BuscarPolinomio b = new BuscarPolinomio();
            int size    = xArray.Length;
            int primero = 0;

            for (int j = 0; j < size; j++)
            {
                if (j != i)
                {
                    float[] cosaX = new float[2];
                    cosaX[0] = xArray[j] * (-1);
                    cosaX[1] = 1;
                    if (primero != 0)
                    {
                        polAnterior = b.multiplicarPolinomios(cosaX, polAnterior);
                    }
                    else
                    {
                        polAnterior = new float[2];
                        polAnterior = cosaX;
                        primero++;
                    }
                }
            }
            return(polAnterior);
        }
Example #2
0
        public float[] buscandoFxResuelto(float[] xArray, float[] yArray)
        {
            int size = xArray.Length;

            Procesamiento_de_datos.BuscarPolinomio buscar = new BuscarPolinomio();

            String lagrangePolynomial = "";

            float[] polAcumulado = new float[1];
            polAcumulado[0] = 0;

            float valorYSobreLX = 0;

            for (int i = 0; i < size; i++)
            {
                float   y   = yArray[i];
                float[] res = new float[1];
                res[0]        = 0;
                valorYSobreLX = paraBuscarFx(xArray, i, y);
                for (int j = 0; j < 1; j++)
                {
                    res = obtenerPolinomioDeLx(xArray, i, res);
                }
                res          = buscar.multiplicarPolinomioXY(res, valorYSobreLX);
                polAcumulado = buscar.sumarPolinomios(res, polAcumulado);

                /*                 lagrangePolynomial =
                 *               lagrangePolynomial + paraBuscarFx(xArray, i, y).ToString() +
                 *               obtenerLasXs(xArray, i);
                 */
            }
            return(polAcumulado);
        }
        public float[] buscandoFxResueltoProgresivo(float[] x, float[] datosDeY)
        {
            Procesamiento_de_datos.BuscarPolinomio buscar = new BuscarPolinomio();
            String devolver = "";

            float[,] y = obtenerTablaDeDiferenciasDivididas(x, crearTabla(datosDeY), x.Length);
            int tamanio = datosDeY.Length - 1;

            devolver = y[0, 0].ToString();
            float[] cuentas = new float[1];
            cuentas[0] = 0;
            for (int i = 0; i < x.Length; i++)
            {
                //      if (i > 1)
                //      {
                float[] temporal = multiplicarTodosPor(protermFloat(i, x), y[0, i]);
                cuentas = buscar.sumarPolinomios(temporal, cuentas);

                /*        }
                 *      else
                 *      {
                 *          cuentas = multiplicarTodosPor(protermFloat(i, x), y[0, i]);
                 *      }*/
            }
            return(cuentas);
        }
        private float[] obtenerPolinomioDeLxProgresivo(float[] xArray, int grado, float[] polAnterior)
        {
            Procesamiento_de_datos.BuscarPolinomio b = new BuscarPolinomio();
            int size    = xArray.Length;
            int primero = 0;

            for (int j = 0; j < grado; j++)
            {
                float[] cosaX = new float[2];
                cosaX[0]    = xArray[j] * (-1);
                cosaX[1]    = 1;
                polAnterior = b.multiplicarPolinomios(cosaX, polAnterior);
            }
            return(polAnterior);
        }