Solve() exception
Hi, my java code is:
public static void evaluateLinearSystem() { try {
F.initSymbols(null);
EvalUtilities util = new EvalUtilities();
StringBufferWriter buf = new StringBufferWriter();
String input = "Solve[{1.0*d*q4+1.0*e == 100,1.0*c*q3 == 100,1.0*a*q1 == 100,1.0*e*q5 == 100,1.0*b*q2 == 100}, {a,b,c,d,e}]";
IExpr result = util.evaluate(input);
OutputFormFactory.get().convert(buf, result);
String output = buf.toString();
System.out.println("Evaluation for " + input + " is " + output);
} catch (Exception e) {
e.printStackTrace();
}
}
It returns the following exception:
java.lang.NullPointerException at org.matheclipse.core.eval.EvalEngine.evalObject(EvalEngine.java:873) at org.matheclipse.core.eval.EvalEngine.evalLoop(EvalEngine.java:824) at org.matheclipse.core.eval.EvalEngine.evalWithoutNumericReset(EvalEngine.java:278) at org.matheclipse.core.eval.EvalEngine.evaluate(EvalEngine.java:297) at org.matheclipse.core.eval.EvalEngine.eval(EvalEngine.java:337) at org.matheclipse.core.expression.F.eval(F.java:2859) at org.matheclipse.core.reflection.system.Roots.rootsOfVariable(Roots.java:123) at org.matheclipse.core.reflection.system.Solve.rootsOfUnivariatePolynomial(Solve.java:421) at org.matheclipse.core.reflection.system.Solve.analyzeSublist(Solve.java:330) at org.matheclipse.core.reflection.system.Solve.analyzeSublist(Solve.java:359) at org.matheclipse.core.reflection.system.Solve.analyzeSublist(Solve.java:359) at org.matheclipse.core.reflection.system.Solve.analyzeSublist(Solve.java:359) at org.matheclipse.core.reflection.system.Solve.analyzeSublist(Solve.java:359) at org.matheclipse.core.reflection.system.Solve.evaluate(Solve.java:499) at org.matheclipse.core.eval.EvalEngine.evalASTBuiltinFunction(EvalEngine.java:644) at org.matheclipse.core.eval.EvalEngine.evalAST(EvalEngine.java:560) at org.matheclipse.core.eval.EvalEngine.evalObject(EvalEngine.java:874) at org.matheclipse.core.eval.EvalEngine.evalLoop(EvalEngine.java:837) at org.matheclipse.core.eval.EvalEngine.evalWithoutNumericReset(EvalEngine.java:278) at org.matheclipse.core.eval.EvalEngine.evaluate(EvalEngine.java:297) at org.matheclipse.core.eval.EvalUtilities.evaluate(EvalUtilities.java:45)
Where am I wrong?
Thanks in advance, Best Regards, Alfredo Rosa
Comments (2)
-
repo owner -
repo owner - changed status to resolved
- Log in to comment
Try this with the latest downloads!?