@@ -47,47 +47,58 @@ This algorithm is faster than JEP math expresion parser!!! If you compare java.m
4747
4848### Real numbers
4949
50+ Parser.SimpleEval("6.5*7.8^2.3 + (3.5^3+7/2)^3 -(5*4/(2-3))*4"); --> for real functions
51+
5052 String f_x = "+3 +5*5*(+1)";
5153
52- ParserResult result = Parser.eval(f_x);
54+ ParserResult result = Parser.eval(f_x); --> for real or complex functions
5355 assertTrue(result.getValue() == 28.0);
5456
5557 final Point xo = new Point("x", new Double(2));
5658 f_x = "2.35*e^(-3)*x";
5759
58- result = Parser.eval(f_x, xo);
60+ result = Parser.eval(f_x, xo); --> for real or complex functions with real or complex vars
5961 assertTrue(result.getValue() == 0.2339992213289606);
6062
61-
6263 final Point xo = new Point("x", new Double(2));
6364 final Point zo = new Point("z", new Double(1));
6465 String f_xs = " 2*(-(((z*3)*sqrt(x^(2)))+3))";
6566
66- Parser.Eval(f_xs, xo, zo);
67+ Parser.Eval(f_xs, xo, zo); --> multiple vars
6768
6869 String f_xs = "x+5*y+(3 -y)";
6970 final Point xo = new Point("x", "1+1");
7071 final Point yo = new Point("y", "0+2*0+1*5-5 +1^4"); //math expression in vars
7172
7273 ParserResult result = Parser.eval(f_xs, xo, yo);
7374
74- final double result = Parser.eval("6.5*7.8^2.3 + (3.5^3+7/2)^3 -(5*4/(2-3))*4", null, null);
75- --> execution time = 4ms in i7-6500U
76-
75+
76+
7777### Complex numbers
78-
79- The last version supports expressions with complex numbers and multiple vars. Here an example:
80-
81- String f_x = " e^(1*x*acos((3/2-2j)^(pi)))";
8278
83- Point xo = new Point("x", new Complex(1, 2));
79+ String f_x = " e^(1*x*acos((3/2-2j)^(pi)))";
80+
81+ Point xo = new Point("x", new Complex(1, 2)); --> complex var: 1+ 2j
8482 ParserResult result = Parser.eval(f_x, xo);
8583
8684 String f_x = "1+j +x";
8785 final Point xo = new Point("x", "2 +j"); //complex math expression in vars
8886
8987 ParserResult result = Parser.eval(f_x, xo);
9088
89+ ### Execution time
90+
91+ These are the results for the version 3.0 (master). You can check the speedTests in the project
92+
93+ Parser.SimpleEval("6.5*7.8^2.3 + (3.5^3+7/2)^3 -(5*4/(2-3))*4 + 6.5*7.8^2.3 + (3.5^3+7/2)^3 -(5*4/(2-3))*4
94+ + 6.5*7.8^2.3 + (3.5^3+7/2)^3 -(5*4/(2-3))*4 + 6.5*7.8^2.3 + (3.5^3+7/2)^3 -(5*4/(2-3))*4");
95+
96+ CPU: i7-6500U
97+
98+ test 1: one execution: 4ms
99+ test 2: 100000 executions : 2100 ms --> mean time 0.021 ms per execution
100+ test 3: million executions: 16500 ms --> mean time 0.0165 ms per execution
101+
91102
92103This version is compiled for Java 1.6
93104
0 commit comments