symja数学分析器中无法识别java Abs[x]
我已经进口了。jar文件,但是
DoubleEvaluator engine = new DoubleEvaluator();
engine.defineVariable("x", -1);
engine.evaluate("Abs[x]");
向我抛出一个错误:org。matheclipse。解析器。客户数学算术MathException:EvalDouble#evaluateFunction(FunctionNode)不可能用于:Abs(x) 及
engine.evaluate("Sin[x]");
没有。这可能是什么原因
Exception in thread "main" org.matheclipse.parser.client.math.ArithmeticMathException: EvalDouble#evaluateFunction(FunctionNode) not possible for: Abs(x)
at org.matheclipse.parser.client.eval.DoubleEvaluator.evaluateFunction(DoubleEvaluator.java:563)
at org.matheclipse.parser.client.eval.DoubleEvaluator.evaluateNode(DoubleEvaluator.java:493)
at org.matheclipse.parser.client.eval.DoubleEvaluator.evaluate(DoubleEvaluator.java:460)
at javaapplication14.JavaApplication14.main(JavaApplication14.java:24)
Java Result: 1
然后运行示例
import org.matheclipse.parser.client.eval.DoubleEvaluator;
public class application {
public static void main(String[] args) {
DoubleEvaluator engine = new DoubleEvaluator();
engine.defineVariable("x",-1);
engine.evaluate("Abs[x]");
}
}
# 1 楼答案
(感谢stacktrace和下载地址)
此问题已在几个小时前解决,最新版本应能解决此问题:
https://bitbucket.org/axelclk/symja_android_library/downloads/symjaMMA2016-01-09.zip
增加了缺失的Abs功能:
看到区别了吗 https://bitbucket.org/axelclk/symja_android_library/diff/symja_android_library/matheclipse-parser/src/main/java/org/matheclipse/parser/client/eval/DoubleEvaluator.java?diff2=c84fa1c92f83&at=master