Пример #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();
        }
Пример #3
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();
        }