static public double SzalF(InitialStatisticalAnalys ISAX, InitialStatisticalAnalys ISAY, List <Data> Q, string RegresTypeN)
        {
            double Szal = 0;

            for (int i = 0; i < ISAX.unsortl.Length; i++)
            {
                Szal += Math.Pow(ISAY.unsortl[i] - RegresType.Model(ISAX.unsortl[i], Q, RegresTypeN), 2);
            }
            Szal /= (ISAX.unsortl.Length - Q.Count);
            return(Math.Sqrt(Szal));
        }
        static public List <Data> RegresParamFound(InitialStatisticalAnalys ISAX, InitialStatisticalAnalys ISAY, double Korelation, string TypeRegVib, ref double Szal2)
        {
            List <Data> Qm = new List <Data>();

            if (TypeRegVib == RegresTypeName.ParabRegresion)
            {
                Data a = new Data(), b = new Data(), c = new Data();
                Qm.Add(a);
                Qm.Add(b);
                Qm.Add(c);
                a.Name = "a";
                b.Name = "b";
                c.Name = "c";
                double n1 = 0;//107 page andan
                double x2 = InitialStatisticalAnalys.StartMoment(ISAX.l, 2);
                double x3 = InitialStatisticalAnalys.StartMoment(ISAX.l, 3);
                double x4 = InitialStatisticalAnalys.StartMoment(ISAX.l, 4);
                for (int i = 0; i < ISAX.unsortl.Length; i++)
                {
                    n1 += (ISAY.unsortl[i] - ISAY.Mx.Q) * (Math.Pow(ISAX.unsortl[i], 2) - x2);
                }
                n1  /= ISAX.unsortl.Length;
                c.Q  = ISAX.Dx.Q * n1 - (x3 - x2 * ISAX.Mx.Q) * Korelation * ISAX.Gx.Q * ISAY.Gx.Q;
                c.Q /= ISAX.Dx.Q * (x4 - Math.Pow(x2, 2)) - Math.Pow(x3 - x2 * ISAX.Mx.Q, 2);
                b.Q  = (x4 - Math.Pow(x2, 2)) * Korelation * ISAX.Gx.Q * ISAY.Gx.Q - (x3 - x2 * ISAX.Mx.Q) * n1;
                b.Q /= ISAX.Dx.Q * (x4 - Math.Pow(x2, 2)) - Math.Pow(x3 - x2 * ISAX.Mx.Q, 2);
                a.Q  = ISAY.Mx.Q - b.Q * ISAX.Mx.Q - c.Q * ISAX.X_2.Q;
                Data a2 = new Data(), b2 = new Data(), c2 = new Data();
                Qm.Add(a2);
                Qm.Add(b2);
                Qm.Add(c2);
                a2.Name = "a2";
                b2.Name = "b2";
                c2.Name = "c2";
                a2.Q    = ISAY.Mx.Q;
                double Mfi2scv = 0;
                {
                    double TD = 0;
                    for (int i = 0; i < ISAX.l.Count; i++)
                    {
                        Mfi2scv += Math.Pow(fi2F(ISAX.unsortl[i], ISAX.Dx.Q, ISAX.Mx.Q, x2, x3), 2);
                        b2.Q    += (ISAX.unsortl[i] - ISAX.Mx.Q) * ISAY.unsortl[i];
                        c2.Q    += fi2F(ISAX.unsortl[i], ISAX.Dx.Q, ISAX.Mx.Q, x2, x3) * ISAY.unsortl[i];
                        TD      += Math.Pow(fi2F(ISAX.unsortl[i], ISAX.Dx.Q, ISAX.Mx.Q, x2, x3), 2);
                    }
                    c2.Q /= TD;
                }
                Mfi2scv /= ISAX.l.Count;
                b2.Q    /= ISAX.l.Count;
                b2.Q    /= ISAX.Dx.Q;
                Szal2    = 0;
                for (int i = 0; i < ISAX.l.Count; i++)
                {
                    Szal2 += Math.Pow(ISAY.unsortl[i] - a2.Q - b2.Q * fi1F(ISAX.unsortl[i], ISAX.Mx.Q) - c2.Q * fi2F(ISAX.unsortl[i], ISAX.Dx.Q, ISAX.Mx.Q, x2, x3), 2);
                }
                Szal2    /= ISAX.l.Count - 3;
                Szal2     = Math.Sqrt(Szal2);
                a2.QSigma = Szal2 / Math.Sqrt(ISAX.unsortl.Length);
                b2.QSigma = Szal2 / (ISAX.Dx.Q * Math.Sqrt(ISAX.unsortl.Length));
                c2.QSigma = Szal2 / Math.Sqrt(ISAX.unsortl.Length * Mfi2scv);
                double Tt = Distributions.StudentQuantile(1 - ISAX.alf.Q / 2, ISAX.unsortl.Length - 3);
                a2.QButton = a2.Q - Tt * a2.QSigma;
                a2.QUpper  = a2.Q + Tt * a2.QSigma;
                b2.QButton = b2.Q - Tt * b2.QSigma;
                b2.QUpper  = b2.Q + Tt * b2.QSigma;
                c2.QButton = c2.Q - Tt * c2.QSigma;
                c2.QUpper  = c2.Q + Tt * c2.QSigma;
                double at = ISAY.Mx.Q - b.Q * ISAX.Mx.Q - c.Q * Math.Pow(ISAX.Mx.Q, 2) - a.Q;
                Data   ta = new Data(), tb = new Data(), tc = new Data();
            }
            else
            {
                Data a = new Data(), b = new Data();
                Qm.Add(a);
                Qm.Add(b);
                a.Name = "a";
                b.Name = "b";
                List <double> t = new List <double>();
                List <double> z = new List <double>();
                for (int i = 0; i < ISAX.unsortl.Length; i++)
                {
                    t.Add(RegresType.FiX(ISAX.unsortl[i], TypeRegVib));
                    z.Add(RegresType.FiY(ISAY.unsortl[i], ISAX.unsortl[i], TypeRegVib));
                }

                /*double Mfx = 0,Mfxfx=0, Mfy = 0, Mfxfy = 0,W = 0;
                 * for (int i = 0; i < ISAX.unsortl.Length; i++)
                 * {
                 *  Mfx += RegresType.FiX(ISAX.unsortl[i], TypeRegVib) *
                 *      RegresType.W(ISAY.unsortl[i], ISAX.unsortl[i], TypeRegVib);
                 *  Mfxfx += Math.Pow(RegresType.FiX(ISAX.unsortl[i], TypeRegVib),2) *
                 *      RegresType.W(ISAY.unsortl[i], ISAX.unsortl[i], TypeRegVib);
                 *  Mfy += RegresType.FiY(ISAY.unsortl[i], ISAX.unsortl[i], TypeRegVib) *
                 *      RegresType.W(ISAY.unsortl[i], ISAX.unsortl[i], TypeRegVib);
                 *  Mfxfy += RegresType.FiX(ISAX.unsortl[i], TypeRegVib) * RegresType.FiY(ISAY.unsortl[i], ISAX.unsortl[i], TypeRegVib) *
                 *      RegresType.W(ISAY.unsortl[i], ISAX.unsortl[i], TypeRegVib);
                 *  W += RegresType.W(ISAY.unsortl[i], ISAX.unsortl[i], TypeRegVib);
                 *
                 * }
                 * Mfx /= W;
                 * Mfxfx /= W;
                 * Mfxfy /= W;
                 * Mfy /= W;*/
                // Qm[1].Q = (Mfxfy - Mfx * Mfy) / (Mfxfx - Math.Pow(Mfx, 2));
                //Qm[0].Q = Mfy - Qm[1].Q * Mfx;
                InitialStatisticalAnalys ISAt = new InitialStatisticalAnalys(t);
                InitialStatisticalAnalys ISAz = new InitialStatisticalAnalys(z);
                double Kor_tz = Correlation_RegressionAnalysis.KorelationFound(ISAt, ISAz);
                Qm[1].Q = Kor_tz * ISAz.Gx.Q / ISAt.Gx.Q;
                Qm[0].Q = RegresType.A(ISAz.Mx.Q - Qm[1].Q * ISAt.Mx.Q, TypeRegVib);
                double Szal = SzalF(ISAX, ISAY, Qm, TypeRegVib);
                Qm[0].QSigma  = RegresType.A(Szal * Math.Sqrt(1.0 / ISAX.unsortl.Length + Math.Pow(ISAt.Mx.Q, 2) / (ISAt.Dx.Q * (ISAX.unsortl.Length - 1))), TypeRegVib);
                Qm[1].QSigma  = Szal / (ISAX.unsortl.Length - 1);
                Qm[0].QButton = RegresType.A(Qm[0].Q - Distributions.StudentQuantile(1 - ISAX.alf.Q / 2, ISAX.unsortl.Length - 2) * Qm[0].QSigma, TypeRegVib);
                Qm[0].QUpper  = RegresType.A(Qm[0].Q + Distributions.StudentQuantile(1 - ISAX.alf.Q / 2, ISAX.unsortl.Length - 2) * Qm[0].QSigma, TypeRegVib);
                Qm[1].QButton = Qm[1].Q - Distributions.StudentQuantile(1 - ISAX.alf.Q / 2, ISAX.unsortl.Length - 2) * Qm[1].QSigma;
                Qm[1].QUpper  = Qm[1].Q + Distributions.StudentQuantile(1 - ISAX.alf.Q / 2, ISAX.unsortl.Length - 2) * Qm[1].QSigma;
            }
            return(Qm);
        }