This Math Parser is one of the best Math parsers ever created. You can easily understand the structure of this package.
If you have any comments please send to: hussam at kfupm.edu.sa
See documentation to know how to use the package in your software.
This is a utility for mathematics parsing. Version 3.0 Beta
Programmed By Hussam Almulhim
It is easily extendable.
To use the package in your code visit:
How to Use this package in your program? click here
To learn more on how the package was programmed designed click here
This Applet is an EXAMPLE of what you can do with this package.
Use Ctrl-C and Ctrl-V to Copy and Paste.
Download Main Library in Jar Format: click here
Download Main Library Source Java Files: click here
Download GUI for Testing: click here
Download Source code for the GUI test: click here
To see Documentation: click here
Requires Java 1.5
How to test this Applet:
1- Click New Formula Work Sheet:
Study the sample sheet.
Start a new session by clearing the screen.
clear the table.
In the "Result" row, enter the expression: Distance / time + 60 * Abs (distance)
click Enter, the table will be updated with these two variables.
Enter the values for these two Variables.
The values can be an expression.
Now, change the value of the "distance" Variable to: ToMeters(10000)
At the bottom you will find the "ToMeters()" function needs to be defined.
Enter this expression for example to define it: cm/100
You can create variables and functions dynamically.
Check the main window for all Available Functions.
2- In the main window click "New Formula Note Sheet"
x= 1000,
y=x*2,
final result = if( Min (x,y)>500 , 500^2 , Max(Cos (x)),
x=1, y=1,
if(x==y, { x=2,
while(y<10 , {
y=y*2,
x=x^2,
}
),
}, (x=1000, y=x))
3- click Add Formula in the Main Window:
To use the package in your code visit:
How to Use this package in your program? click here
Small Example:
To start using the package do the following:
//import the required packages:
import hussam.math.operations.*;
import hussam.math.operations.parser.*;
import hussam.math.operations.extra.*;
public class TestMathParser{
public static void main(String[]args)throws MathException{
//استخدم الدالة التالية حتى تحصل على قارئ للدوال الرياضية
//get a reader from the DynamicExpressionReader class, or the ExpressionReader class.
OperationReader reader = DynamicExpressionReader.getInstance();
//اقرأ الدالة التالية بالطريقة المدونة التالية
//Read an operation:
Operation o1= reader.readOperation(" x + 4 * Cos (60)");
//اطبع ناتج العملية مع ملاحظة أن المتغير يساوي صفرا
//print the result:
System.out.println("x=0 Result of operation: "+o1+" = " +o1.result());
//نغير قيمة المتغير المدخل إلى 10
//change the value of variable x:
reader.getOperatorSource().getLocalVariable("x").setOperation(new ConstantNumber(10));
//اطبع الناتج مرة أخرى
//print the result again:
System.out.println("x=10 Result of operation: "+o1+" = " +o1.result());
}
}
----------------------------------------------
Any Problems please email me.
Be sure that you have Java 5.