3334353637383940414243
for (Double p : points) { Calculable calc = new ExpressionBuilder(equation.getEquation()).withVariable( String.valueOf(equation.getIndependentVariable()), p).build(); results.add(calc.calculate()); } return new Solution(results, 0, 10, 1); } }
132133134135136137138139140141142
List<Double> results = new ArrayList<Double>(); for (String f : function) { Calculable calc = new ExpressionBuilder(f).withVariables(map).build(); results.add(calc.calculate() * h); } return results; }
118119120121122123124125126127128
138139140141142143144145146147148
{ List<Double> result = new ArrayList<Double>(function.size()); for (String f : function) { Calculable calc = new ExpressionBuilder(f).withVariables(map).build(); result.add(calc.calculate() * h); } results.add(result); } return results;
242526272829303132
public Map<String, Object> evaluate(HttpServletRequest request) throws UnknownFunctionException, UnparsableExpressionException { String query = request.getParameter("query"); Calculable calc = new ExpressionBuilder(query).build(); return Collections.singletonMap(query, (Object) calc.calculate()); } }