public static Parser.Parser ParseCore(this string expression, ExprBuilder builder) { Scanner scanner = new Scanner(expression); Parser.Parser parser = new Parser.Parser(scanner, builder); parser.Parse(); return parser; }
public static Expr Diff(this Expr expr, ExprBuilder builder, string parameterName = null) { return expr.Visit(new DiffExpressionVisitor(builder, parameterName)); }
protected override Expr DiffCore(ExprBuilder builder, Expr arg) { return FunctionFactory.Exp(arg); }
protected override Expr DiffCore(ExprBuilder builder, Expr arg) { return Expr.Function(FunctionFactory.CosName, arg); }
protected override Expr DiffCore(ExprBuilder builder, Expr arg) { return builder.Inverse(arg); }
public static Expr Parse(this string expression, ExprBuilder builder = null) { return GetExpression(ParseCore(expression, builder ?? ExprBuilderFactory.CreateDefault())); }
public DiffExpressionVisitor(ExprBuilder builder, string parameterName) { this.builder = builder; this.parameterName = parameterName; autoParameterName = !HasParameter; }
protected abstract Expr DiffCore(ExprBuilder builder, Expr arg);