コード例 #1
0
        public void Get_derivative_simplified2()
        {
            BigFunction func  = new BigFunction();
            string      input = "/(+(*(7,x),+(-(6,-(*(8,x),*(4,x))),*(n(12),x))),*(2,x))";

            func.RootFunc = func.Insert(ref input);
            OxyPlot.WindowsForms.PlotView pv1 = new PlotView();
            pv1.Model = new PlotModel {
            };

            FunctionSeries serie = new FunctionSeries();

            serie = func.GetFunctionSerieForDerivativeAnalyticallySimplify();

            pv1.Model.Series.Add(serie);
            Assert.AreEqual(func.ParseToString(func.RootFunc.GetDerivativeAnalytically().SimplifyFunction()), "((((7 + (( - 4) + 12)) * (2 *  x )) - (((7 *  x ) + ((6 - ((8 *  x ) - (4 *  x ))) + (12 *  x ))) * 2)) / ((2 *  x ) ^ 2))");
        }
コード例 #2
0
        public void Get_derivative_simplified1()
        {
            BigFunction func  = new BigFunction();
            string      input = "-(*(/(c(*(r(-5.7),x)),s(l(+(n(27),*(3,^(p,8)))))),!(4)),e(-2))";

            func.RootFunc = func.Insert(ref input);
            OxyPlot.WindowsForms.PlotView pv1 = new PlotView();
            pv1.Model = new PlotModel {
            };

            FunctionSeries serie = new FunctionSeries();

            serie = func.GetFunctionSerieForDerivativeAnalyticallySimplify();

            pv1.Model.Series.Add(serie);
            Assert.AreEqual(func.ParseToString(func.RootFunc.GetDerivativeAnalytically().SimplifyFunction()), "((((5.7 *  sin ((-5.7 *  x ))) *  sin ( ln ((27 + (3 * ( p  ^ 8)))))) / ( sin ( ln ((27 + (3 * ( p  ^ 8))))) ^ 2)) * 4 ! )");
        }
コード例 #3
0
        public void Parse_to_string()
        {
            var         form  = new btnAddPoint();
            BigFunction func  = new BigFunction();
            string      input = "*(/(s(x),+(c(x),l(-(*(p,x),4)))),e(!(2)))";

            func.RootFunc = func.Insert(ref input);
            OxyPlot.WindowsForms.PlotView pv1 = new PlotView();
            pv1.Model = new PlotModel {
            };
            FunctionSeries serie = new FunctionSeries();

            serie = func.GetFunctionSerieMainFunction();

            pv1.Model.Series.Add(serie);
            func.GenerateTextFile(func.RootFunc);
            Assert.AreEqual(func.ParseToString(func.RootFunc), "(( sin ( x ) / ( Cos ( x ) +  ln ((( p  *  x ) - 4)))) *  e (2 ! ))");
        }
コード例 #4
0
        public void Get_derivative()
        {
            BigFunction func  = new BigFunction();
            string      input = "-(*(/(c(*(r(-5.7),x)),s(l(+(n(27),*(3,^(p,8)))))),!(4)),e(-2))";

            func.RootFunc = func.Insert(ref input);
            OxyPlot.WindowsForms.PlotView pv1 = new PlotView();
            pv1.Model = new PlotModel {
            };

            FunctionSeries serie1 = new FunctionSeries();

            serie1 = func.GetFunctionSerieForDerivativeAnalytically();

            FunctionSeries serie2 = new FunctionSeries();

            serie2 = func.GetFunctionSerieForDerivativeNewton();

            pv1.Model.Series.Add(serie1);
            pv1.Model.Series.Add(serie2);
            Assert.AreEqual(func.ParseToString(func.RootFunc.GetDerivativeAnalytically()), "((((((((-1 * ((0 *  x ) + (-5.7 * 1))) *  sin ((-5.7 *  x ))) *  sin ( ln ((27 + (3 * ( p  ^ 8)))))) - ( Cos ((-5.7 *  x )) * (((0 + ((0 * ( p  ^ 8)) + (3 * ((8 * ( p  ^ 7)) * 0)))) / (27 + (3 * ( p  ^ 8)))) *  Cos ( ln ((27 + (3 * ( p  ^ 8)))))))) / ( sin ( ln ((27 + (3 * ( p  ^ 8))))) ^ 2)) * 4 ! ) + (( Cos ((-5.7 *  x )) /  sin ( ln ((27 + (3 * ( p  ^ 8)))))) * 0)) - (0 *  e (2)))");
        }