Exemplo n.º 1
0
        public static double simpsonRuleM(Expr expr, string varName, double a, double b)
        {
            var f = expr.Compile(varName);

            f = Differentiate.SecondDerivativeFunc(Differentiate.SecondDerivativeFunc(f));

            return(max(f(a), f(b)));
        }
Exemplo n.º 2
0
        public static double evaluate(
            [Desc("The equation to evaluate.")] Expr expr,
            [Desc("The name of the first variable in the equation.")] string aName, [Desc("The value of the first variable.")] double a,
            [Desc("The name of the second variable in the equation.")] string bName, [Desc("The value of the second variable.")] double b)
        {
            var f = expr.Compile(aName, bName);

            return(f(a, b));
        }
Exemplo n.º 3
0
        public static double evaluate(
            [Desc("The equation to evaluate.")] Expr expr,
            [Desc("The name of the variable in the equation.")] string aName,
            [Desc("The value of the variable.")] double a)
        {
            var f = expr.Compile(aName);

            return(f(a));
        }
Exemplo n.º 4
0
        public static double trapezoidalRuleEt(Expr expr, string varName, double a, double b, int n)
        {
            var f = expr.Compile(varName);

            double trValue = NewtonCotesTrapeziumRule.IntegrateComposite(f, a, b, n);

            double trueValue = Integrate.OnClosedInterval(f, a, b);

            return(abs(trueValue - trValue));
        }
Exemplo n.º 5
0
        public static double simpsonRuleEs(Expr expr, string varName, double a, double b, int n)
        {
            var f = expr.Compile(varName);

            double srValue = SimpsonRule.IntegrateComposite(f, a, b, n);

            double trueValue = Integrate.OnClosedInterval(f, a, b);

            return(abs(trueValue - srValue));
        }
Exemplo n.º 6
0
        public static double evaluate(
            [Desc("The equation to evaluate.")] Expr expr,
            [Desc("The name of the first variable in the equation.")] string aName, [Desc("The value of the first variable.")] double a,
            [Desc("The name of the second variable in the equation.")] string bName, [Desc("The value of the second variable.")] double b,
            [Desc("The name of the third variable in the equation.")] string cName, [Desc("The value of the third variable.")] double c,
            [Desc("The name of the fourth variable in the equation.")] string dName, [Desc("The value of the fourth variable.")] double d)
        {
            var f = expr.Compile(aName, bName, cName, dName);

            return(f(a, b, c, d));
        }
Exemplo n.º 7
0
        public static double simpsonRule(Expr expr, string varName, double a, double b, int n)
        {
            var f = expr.Compile(varName);

            return(SimpsonRule.IntegrateComposite(f, a, b, n));
        }
Exemplo n.º 8
0
        public static double trapezoidalRuleError(Expr expr, string varName, double a, double b, double Et)
        {
            var f = expr.Compile(varName);

            return(NewtonCotesTrapeziumRule.IntegrateAdaptive(f, a, b, Et));
        }
Exemplo n.º 9
0
        public static double trapezoidalRule(Expr expr, string varName, double a, double b, int n)
        {
            var f = expr.Compile(varName);

            return(NewtonCotesTrapeziumRule.IntegrateComposite(f, a, b, n));
        }
Exemplo n.º 10
0
        public static double integral(Expr expr, string varName, double a, double b)
        {
            var f = expr.Compile(varName);

            return(Integrate.OnClosedInterval(f, a, b));
        }
Exemplo n.º 11
0
        public static double fourthDerivative(Expr expr, string varName, double x)
        {
            var f = expr.Compile(varName);

            return(Differentiate.SecondDerivative(Differentiate.SecondDerivativeFunc(f), x));
        }
Exemplo n.º 12
0
        public static double firstDerivative(Expr expr, string varName, double x)
        {
            var f = expr.Compile(varName);

            return(Differentiate.FirstDerivative(f, x));
        }