0
public static void solveInequalitiesEquationSymja(){
    EvalUtilities util = new EvalUtilities(false, true);
    IExpr result = util.evaluate("x^2<x");
    IExpr result2 = Solve(result,x);
    System.out.println("################## Inequalities equation ##################");
    System.out.println(result);
    System.out.println(result2);
}

结果是 x^2 < x

结果 2 是求解(x^2< x,x)

public static void solveModuleEquationSymja() {
ExprEvaluator util = new ExprEvaluator();

Parser parser = new Parser();
ASTNode exprNode = parser.parse("Sqrt[x^2] == 7");
AST2Expr ast2Expr = new AST2Expr();
IExpr ast = ast2Expr.convert(exprNode);

IAST function = Solve(ast, x);
IExpr result = util.evaluate(function);

System.out.println("################## Module equation ##################");
System.out.println(result);

}

{{x->-7},{x->7}} 有没有不使用 sqrt(x^2) 而是直接使用模数(x) 的解决方案?

先感谢您

4

1 回答 1

0

At the moment inequalities aren't supported in Solve().

Did you mean something like "x^2==49"?

public static void solveModuleEquationSymja() {
    ExprEvaluator util = new ExprEvaluator();
    IExpr result = util.evaluate("Solve(x^2 == 49,x)");
    System.out.println("################## Module equation ##################");
    System.out.println(result);
}
于 2015-10-03T22:22:11.150 回答