@SuppressWarnings("deprecation") public static double evaluate(String expr,HashMap<String,Double> symbols) throws Exception {
  SymbolFactory sf;
  ByteArrayInputStream parserInput;
  Parser parser;
  sf=new DefaultSymbolFactory();
  parserInput=new ByteArrayInputStream(expr.getBytes());
  parser=new Parser(new Scanner(parserInput,sf),sf);
  parser.setSymbols(symbols);
  parser.parse();
  return parser.getResult();
}

@ SuppressWarnings ( "deprecation" ) public static double evaluate ( String expr , HashMap < String , Double > symbols ) throws Exception { SymbolFactory sf ; ByteArrayInputStream parserInput ; Parser parser ; sf = new DefaultSymbolFactory ( ) ; parserInput = new ByteArrayInputStream ( expr . getBytes ( ) ) ; parser = new Parser ( new Scanner ( parserInput , sf ) , sf ) ; parser . setSymbols ( symbols ) ; parser . parse ( ) ; return parser . getResult ( ) ; }
parses and evaluates the given expression . returns the result of the mathematical expression , based on the given values of the symbols .
