示例#1
0
        public void Calculate()
        {
            float xp = (float)dane.GetXp();
            float xk = (float)dane.GetXk();
            float h  = (float)dane.GetN();
            int   n  = (int)((xk - xp) / h);

            float ybuf = dane.getPoint(0).Y;
            float xbuf = dane.getPoint(0).X;

            for (int i = 0; i < n; i++)
            {
                float  x1    = xbuf + h;
                float  k1    = h * (float)dane.getFunctionInPointXY(xbuf, ybuf);
                float  k2    = h * (float)dane.getFunctionInPointXY(xbuf + h / 2, k1 / 2 + ybuf);
                float  k3    = h * (float)dane.getFunctionInPointXY(xbuf + h / 2, k2 / 2 + ybuf);
                float  k4    = h * (float)dane.getFunctionInPointXY(xbuf + h, k3 + ybuf);
                float  y1    = ybuf + (k1 + 2 * k2 + 2 * k3 + k4) / 6;
                PointF bufor = new PointF(x1, y1);
                dane.AddPoint(bufor);
                // Console.WriteLine(x1 + ": " + y1);
                xbuf = x1;
                ybuf = y1;
            }
            dane.SetDrawable();
        }
示例#2
0
        public void Calculate()
        {
            float xp   = (float)dane.GetXp();
            float xk   = (float)dane.GetXk();
            float h    = (float)dane.GetN();
            int   n    = (int)((xk - xp) / h);
            float ybuf = dane.getPoint(0).Y;
            float xbuf = dane.getPoint(0).X;

            for (int i = 0; i < n; i++)
            {
                float  yn    = ybuf + h / 2 * ((float)dane.getFunctionInPointXY(xbuf, ybuf) + (float)dane.getFunctionInPointXY(xbuf + h, ybuf + h * (float)dane.getFunctionInPointXY(xbuf, ybuf)));
                float  xn    = xbuf + h;
                PointF bufor = new PointF(xn, yn);
                dane.AddPoint(bufor);
                // Console.WriteLine(xn+": "+ yn );
                xbuf = xn;
                ybuf = yn;
            }
            dane.SetDrawable();
        }
        public double Calculate()
        {
            double wynik        = 0;
            double SizeOfPoints = dane.SizeOfPoints();
            double toFind       = dane.GettoFind();

            for (int i = 0; i < SizeOfPoints; i++)
            {
                double Lx = 1;
                for (int j = 0; j < SizeOfPoints; j++)
                {
                    if (i == j)
                    {
                        continue;
                    }
                    Lx *= (toFind - dane.getPoint(j).X) / (dane.getPoint(i).X - dane.getPoint(j).X);
                }
                wynik += dane.getPoint(i).Y *Lx;
            }
            return(wynik);
        }
示例#4
0
        private void GenerateRow()
        {
            int           liczbaPunktow = dane.SizeOfPoints();
            List <double> bufor         = new List <double>();

            for (int i = 1; i < liczbaPunktow; i++)
            {
                double wynik = (dane.getPoint(i).Y - dane.getPoint(i - 1).Y) / (dane.getPoint(i).X - dane.getPoint(i - 1).X);
                bufor.Add(wynik);
            }
            rzad.Add(bufor);
            int punktow_bufor = liczbaPunktow - 1;

            for (int j = 1; j < liczbaPunktow - 1; j++)
            {
                bufor = new List <double>();
                for (int i = 1; i < punktow_bufor; i++)
                {
                    double wynik = (rzad[j - 1][i] - rzad[j - 1][i - 1]) / (dane.getPoint(i + j).X - dane.getPoint(i - 1).X);
                    bufor.Add(wynik);
                }
                punktow_bufor--;
                rzad.Add(bufor);
            }
        }
示例#5
0
        public void Calculate()
        {
            float xp = (float)dane.GetXp();
            float xk = (float)dane.GetXk();
            float h  = (float)dane.GetN();
            int   n  = (int)((xk - xp) / h);

            int   iterator = 0;
            float y_temp   = dane.getPoint(0).Y;

            for (float i = xp; i < xk; i += h)
            {
                float  y1    = y_temp + h * (float)dane.getFunctionInPointXY(i, y_temp);
                PointF bufor = new PointF(i + h, y1);
                dane.AddPoint(bufor);
                //Console.WriteLine((i + h).ToString()+"   "+y1);
                y_temp = y1;
                iterator++;
            }
            dane.SetDrawable();
        }
示例#6
0
        public bool IsCalculated()
        {
            bool   step1 = (dane.SizeOfPoints() == 3) ? true : false;
            double w     = dane.getPoint(0).X *dane.getPoint(0).X *dane.getPoint(1).X + dane.getPoint(0).X *dane.getPoint(2).X *dane.getPoint(2).X + dane.getPoint(1).X *dane.getPoint(1).X *dane.getPoint(2).X - dane.getPoint(1).X *dane.getPoint(2).X *dane.getPoint(2).X - dane.getPoint(0).X *dane.getPoint(1).X *dane.getPoint(1).X - dane.getPoint(0).X *dane.getPoint(0).X *dane.getPoint(2).X;
            bool   step2 = (w != 0) ? true : false;

            return(step1 && step2 && !Double.IsNaN(dane.GettoFind()));
        }