예제 #1
0
        public void DrawDerNe(BinaryTree tree)
        {
            this.treeDerN = tree;
            float    xin = p1.Width / 2;
            float    yin = p1.Height / 2;
            Graphics g   = p1.CreateGraphics();

            g.TranslateTransform(xin, yin);
            for (float i = -xin; i <= xin; i++)
            {
                try
                {
                    float x1 = i / this.coef;
                    float x2 = (i + 1) / this.coef;
                    float y1 = (float)tree.DerivativeNeuton(x1);
                    float y2 = (float)tree.DerivativeNeuton(x2);
                    g.DrawLine(Pens.Orange, x1 * this.coef, -y1 * this.coef, x2 * this.coef, -y2 * this.coef);
                }
                catch (OverflowException)
                {
                }
            }
        }
예제 #2
0
        private void DrawDerivativeNeuton()
        {
            var myModel = new PlotModel {
                Title = tree.ReadDerivative()
            };
            FunctionSeries series = new FunctionSeries();

            for (double i = -100; i < 100; i++)
            {
                double y = tree.DerivativeNeuton(i);
                series.Points.Add(new DataPoint(i, y));
            }

            myModel.Series.Add(series);
            this.plot1.Model = myModel;
        }