CalM is Java library for evaluating mathematical expressions. The following snippet shows how to use the math parser in code.
Stringinput="5.2+ln 2e^sin 2.6pi";MathParserparser=StandardConfig.getParser();try{Expressionexpress=parser.parse(input);Operandresult=express.evaluate(true);System.out.println(result.getValue());}catch(RPNExceptionex){System.out.println("Error:" + ex.getMessage()); // The exception might have a fragment with the location of the error. ex.getDetail().ifPresent(fragment -> { // The fragment's position is a zero-based char index. System.out.println("Atposition:"+(fragment.getPosition()+1));});}
CalM also includes a script interpreter that's based on the math parser. Below is a script that calculates the first iterations of the sequence Zn+1 = Zn^2 + c in the orbit of zero. The script prompts the user for the complex number c and the number of iterations to run. Convergence of this sequence determines whether c is in the Mandelbrot set or not.
CalM
CalM is Java library for evaluating mathematical expressions. The following snippet shows how to use the math parser in code.
CalM also includes a script interpreter that's based on the math parser. Below is a script that calculates the first iterations of the sequence Zn+1 = Zn^2 + c in the orbit of zero. The script prompts the user for the complex number c and the number of iterations to run. Convergence of this sequence determines whether c is in the Mandelbrot set or not.
Last edit: Tone Sommerland ™ 2016-05-17