Example #1
0
        private void IterativePrepare(double xs)
        {
            zedIterative.GraphPane.CurveList.Clear();
            MyExtension.Function f = (x => Math.Pow(Math.Abs(Math.Cos(x)), 0.5));

            zedIterative.Graph(f, -10, 10, 0.1, Color.Red);
            zedIterative.Graph(x => x, -10, 10, 1, Color.Blue);


            PointPairList list = new PointPairList();

            double x0, x1 = xs;

            iterativeLogger.Items.Clear();
            list.Add(x1, f(x1));
            do
            {
                x0 = x1;
                x1 = f(x0);
                list.Add(x0, x1);
                iterativeLogger.Items.Add(
                    String.Format("X =  + {0:0.#####} + ; f(x) =  + {1:0.########}", x1, f(x1)));
            } while (Math.Abs(x1 - x0) > Eps);


            LineItem line = zedIterative.GraphPane.AddCurve("", list, Color.Green, SymbolType.Diamond);

            line.Line.IsVisible = false;

            zedIterative.AxisChange();
        }
Example #2
0
        private void ChordPrepare(double a, double b)
        {
            zedChord.GraphPane.CurveList.Clear();

            MyExtension.Function f = (x => x * x * x - 18 * x - 83);

            zedChord.Graph(f, 2, 10, 0.1, Color.Blue);

            double x0 = a, x1 = b, x2;

            PointPairList list = new PointPairList();

            ChordLogger.Items.Clear();

            do
            {
                x2 = x1 - f(x1) * (x1 - x0) / (f(x1) - f(x0));
                x0 = x1;
                x1 = x2;
                list.Add(x2, f(x2));

                ChordLogger.Items.Add(
                    String.Format("x = {0:0.#####}, f(x) = {1:0.##########}", x2, f(x2)));
            } while (Math.Abs(f(x2)) > Eps);


            LineItem line = zedChord.GraphPane.AddCurve("", list, Color.Green, SymbolType.Diamond);

            line.Line.IsVisible = false;

            zedChord.AxisChange();
        }
Example #3
0
        private void NewtonPrepare(double xs)
        {
            zedNewton.GraphPane.CurveList.Clear();

            MyExtension.Function f  = (x => - Math.Pow(x, 3) + Math.Cos(x));
            MyExtension.Function fs = (x => - 3 * x * x - Math.Sin(x));

            zedNewton.Graph(f, -2, 2, 0.05, Color.Red);

            double x0, x1 = xs;

            PointPairList list = new PointPairList();

            list.Add(x1, f(x1));

            NewtonLogger.Items.Clear();

            do
            {
                x0 = x1;
                x1 = x0 - f(x0) / fs(x0);
                list.Add(x1, f(x1));
                NewtonLogger.Items.Add(
                    String.Format("x={0:0.###},f(x)={1:0.############}", x1, f(x1)));
            } while (Math.Abs(f(x1)) > Eps);

            LineItem line = zedNewton.GraphPane.AddCurve("", list, Color.Green, SymbolType.Diamond);

            line.Line.IsVisible = false;

            zedNewton.AxisChange();
        }