JbcParser is a Java library to parse and evaluate mathematical expressions given as strings at runtime.
JbcParser source code can be compiled with JDK 5, 6, 7 and 8. The binaries are compiled with JDK 1.5 for backward compatibility. You get the source code and the compiled jar when you buy this parser library.
View the Javadoc documentation of the Java Math Parser. Download javadocs as compressed zip file [bcParser_javadocs.zip -
23KB].
Math Parser for Java
JbcParser Math Parser library features include:
Easy to use, simple class API.
Comes with predefined functions.
You can create custom functions/variables and get callbacks to your own functions in your source code.
IVariableResolver to provide values for undefined variables.
Function/variable names start with letters and can contain letters, numbers and �_�.
Optimization: Constant expression elimination for repeated tasks.
Operators: +, -, /, *, ^
Boolean Operators: <, >, =, &, |, ! ,<>, >=, <=
Paranthesis: (, {, [
Functions in the form of: f(x,y,z, ...)
Function parameter calculations are only done if needed.
List of predefined functions is available in the documentation.
Provides localization support.
Optional locale specific decimal separator support (dot or comma).
Royalty free distribution.
Source code is included.
JbcParser is especially useful in scientific and engineering programs as well as financial spread sheet implementations.
Purchase and Download
Download evaluation version of JbcParser
Java Example Code
Example of Custom Function Definition
junit - unit test results
Examples of typical mathematical expressions are:
SIN(3.14)+5^2+POW(2,MAX(X* 2,Y))
|
Functions, variables, constants can be nested. Common math functions are defined by default.
|
2*[LN(1+X) / LOG(1-X)]
|
Paranthesis can be (, {, [ for readability.
|
IF(X>0, 3/X, F(X))
|
You can avoid Division By Zero errors as in 3/X. (3/X will not be evaluated if X>0 is false - parameters to functions
are evaluated only if required by the internal logic of a function).
IF(a,b,c) branching function is supported.
Boolean operators are supported. Any non-zero value is TRUE, 0 is FALSE.
Functions can be defined to have 1,2,...N numbers of parameters.
|
PI*(R^2)
|
Constants supported. For example, PI is a constant, not a variable. When optimization is turned on, constants may improve the speed of repeated evaluations
where expression does not change but variable values change.
|
X+Y/LOG(1+5)
|
If Optimization is turned ON, LOG(1+5) will be optimized away since it is a constant.
|
VOLUME(HEIGHT, WIDTH, LENGTH)
|
You can create your own functions and variables and name them as you wish.
You can replace a predefined function with your own implementation.
|
X+COSH(3E-2)
|
Scientific notation is supported: 3E-2
|
SUM(1,2,3,4,5,6,...n)
|
Functions that take unknown number of parameters are supported.
|
To be efficient in repeated calculations, parser creates a parse tree at first and re-uses this parse tree for each evaluation without the need to reparse.
Optimizer: If Optimization is on, the parse tree will be optimized by calculating constant expression sections at once so that further evaluation requests will be quicker without the need to re-evaluate
those constant branches.
JbcParser comes with the Java source code and there is also help documentation available for reference. Download is a single zip file with size of around 290KB. Package contains source files, Jar file,
sample Applet, JavaDocs.
Here is a short code snippet to help you get started using JbcParser. List of predefined math functions are available in the javadocs.
Release version comes with full Java source code.
Software License for your review.
The Math Parser Component is also available on many platforms/languages such as:
Purchasing JbcParser Math Parser Component for Java
You can pay with credit card and download JbcParser immediately from our online store for only $29.95. Full version includes Java
source code. Upgrades are free for registered users. Licensing is per developer. You can deploy the the component royalty free with your
applications as many times as you want. Site license allows any number of developers use the component at your development site. Site License is $290.95. Site licenses can be purchased here.
For technical questions please contact support@gobestcode.com
Math Parser Online Store
|