static double[] Lap_Tien(double[,] Saiphan, double Y)
        {
            int    n        = Saiphan.GetLength(0);
            double Giaithua = 1;
            int    k        = 0;

            double[] Pn = new double[n];

            for (int i = 2; i < n; i++)
            {
                Giaithua *= i;
            }

            for (int i = n - 1; i >= 0; i--)
            {
                if (i == 0)
                {
                    Pn[n - 1] += (Y - Saiphan[0, 0]) / Saiphan[0, 1];
                }

                if (i == 1)
                {
                    continue;
                }

                if (i > 1)
                {
                    double[] Xi = new double[i];

                    for (int j = 0; j < i; j++)
                    {
                        Xi[j] = j;
                    }

                    double[] Horner = HornerPn.Nhandathuc(Xi);


                    for (int j = 0; j < Horner.Length; j++)
                    {
                        Horner[j]  = -Horner[j];
                        Horner[j] *= Saiphan[0, i] / (Saiphan[0, 1] * Giaithua);
                        Pn[j + k] += Horner[j];
                    }
                    Giaithua /= i;
                    k++;
                }
            }

            for (int i = 0; i < n; i++)
            {
                if (Pn[i] < 0.0000001)
                {
                    Pn[i] = Math.Round(Pn[i], 6);
                }
            }

            return(Pn);
        }
示例#2
0
        static double[] DaThucBessel(double[,] Saiphan)
        {
            int    n = Saiphan.GetLength(0);
            int    k = 0;
            int    mid = (n - 1) / 2;
            int    a = 0, b = n - 1;
            double Giaithua = 1;

            double[]      Pn   = new double[n];
            List <double> Heso = new List <double>();

            for (int i = 2; i < n; i++)
            {
                Giaithua *= i;
            }

            for (double i = -mid + 1; i <= mid - 1; i++)
            {
                Heso.Add(i);
            }

            for (int i = n - 1; i >= 0; i--)
            {
                if (i == 0)
                {
                    Pn[n - 1] += Saiphan[mid, mid];
                }

                if (i == 1)
                {
                    Pn[n - 2] += (Saiphan[mid, mid + 1] + Saiphan[mid - 1, mid]) / 2;
                }

                if (i == 2)
                {
                    Pn[n - 3] += Saiphan[mid - 1, mid + 1] / 2;
                }

                if (i > 2)
                {
                    if (i % 2 == 0)
                    {
                        Heso.Add(0);

                        double[] Xi     = Heso.ToArray();
                        double[] Horner = HornerPn.Nhandathuc(Xi);
                        for (int j = 0; j < Horner.Length; j++)
                        {
                            Horner[j] *= Saiphan[a, b] / Giaithua;
                            Pn[j + k] += Horner[j];
                        }
                        Heso.RemoveAt(Heso.Count - 1);
                    }

                    if (i % 2 != 0)
                    {
                        double[] Xi     = Heso.ToArray();
                        double[] Horner = HornerPn.Nhandathuc(Xi);
                        a++;
                        b--;
                        for (int j = 0; j < Horner.Length; j++)
                        {
                            Horner[j] *= (Saiphan[a, b + 1] + Saiphan[a - 1, b]) / (2 * Giaithua);
                            Pn[j + k] += Horner[j];
                        }
                        Heso.RemoveAt(0);
                        Heso.RemoveAt(Heso.Count - 1);
                    }
                    Giaithua /= i;
                    k++;
                }
            }

            return(Pn);
        }
示例#3
0
        public static double [] Gauss_Tien_1(double [,] Saiphan)
        {
            int    n = Saiphan.GetLength(0);
            int    k = 0;
            int    mid = (n - 1) / 2;
            int    a = 0, b = n;
            double Giaithua = 1;

            double[]      Pn   = new double[n];
            List <double> Heso = new List <double>();

            for (int i = 2; i < n; i++)
            {
                Giaithua *= i;
            }

            for (double i = -mid; i <= mid; i++)
            {
                Heso.Add(i);
            }

            for (int i = n - 1; i >= 0; i--)
            {
                if (i == 0)
                {
                    Pn[n - 1] += Saiphan[mid, mid];
                }

                if (i == 1)
                {
                    Pn[n - 2] += Saiphan[mid, mid + 1];
                }

                if (i > 1)
                {
                    double[] Xi = new double[i];

                    if (i % 2 == 0)
                    {
                        b--;
                        Heso.RemoveAt(0);
                    }

                    if (i % 2 != 0)
                    {
                        a++;
                        Heso.RemoveAt(i);
                    }

                    for (int j = 0; j < i; j++)
                    {
                        Xi[j] = Heso[j];
                    }

                    double[] Horner = HornerPn.Nhandathuc(Xi);

                    for (int j = 0; j < Horner.Length; j++)
                    {
                        Horner[j] *= (Saiphan[a, b] / Giaithua);
                        Pn[j + k] += Horner[j];
                    }

                    Giaithua /= i;
                    k++;
                }
            }

            return(Pn);
        }