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@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 Al-Mulhim
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"
![]() | see the example, and click calculate. |
![]() | you will see the results of all variables. |
![]() | clear the screen. |
![]() | Insert this Text (Copy and Paste using Ctrl C and Ctrl V): |
x= 1000,
y=x*2,
final result = if( Min (x,y)>500 , 500^2 , Max(Cos (x)),
![]() | click Calculate. |
![]() | Try this also: |
x=1, y=1,
if(x==y, { x=2,
while(y<10 , {
y=y*2,
x=x^2,
}
),
}, (x=1000, y=x))
![]() | click calculate. |
![]() | The expression reader supports If statements and While loops! |
3- click Add Formula in the Main Window:
![]() | This utility is used to add Formulas to the Database. |
![]() | insert a name, a description and then the expression used to evaluate the formula. |
![]() | You can use this formula in other sheets. |
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.