Evaluate com.javathings.math |
Purchase package
The com.javathings.math package is
just $20 (USD) You can purchase the package online here: http://www.regsoft.net/purchase.php3?productid=31612 Purchasing the package gives you: - The com.javathings.math package with right to include it in your applications and applets. - Full documentation. - Future bug fixes and minor version upgrades. - Source for the sample applets. |
General description
The purpose of this package is to evaluate a mathematical
expression
given as a String to a double value, this is useful in all sorts of applications
such as calculators, bar charts, educational and financial applications.
The package can also symbolically differentiate a mathematical expression.
Using the package is simple, example:
Eval e = new Eval();
try{
System.out.println( e.eval( "x-cos(x+y)"
, "x=2.3;y=pi" ) );
}catch( Exception e ){}
This will print the value: 1.63372...
Demos
There is no demo of the actual package included here but you can
evaluate
the functionality and speed of the package by testing the applets and
applications that is based
on the package by following the links below.
If you have more questions after testing these applets and after reading this
document please
email patrik@javathings.com
To evaluate the speed of the Eval class use the SpeedTest program, it will evaluate
an expression any number of times and display the consumed time in milliseconds.
To run the SpeedTest on Windows click on the SpeedTest.exe, to run it on other systems
use the speedtest.jar file and run a command like:
jre -cp speedtest.jar SpeedTest
or with Java2:
java -jar speedtest.jar
Note that the actual performance of the package is based on a number of things
including the performance of the JVM you are using, you should also try to evaluate
the same expression several times to see the effects from JVM optimization.
The following links are applets using the package:
Finally you can download this Desktop calculator
General information
A more complete description of the package can be found in the documentation
Size of the package is about 80kb, it is packaged as a jar file
but can easily be extracted if you for some reason cannot use
a jar file ( for example when writing applets for older browsers ).
The package conforms to the Java 1.02 API which ensures
that it will run on all the JVM's on the market, from 1.0 and up.
These are the classes the package contains:
Derive.class
Eval.class
Node.class
Operators.class
notValidSyntaxException.class
cannotConvertException.class
The Eval.class evaluates a mathematical expression given as a String and the
Derive.class performs symbolic differentiation on a mathematical expression
given as a String.
Methods in Eval.class
public synchronized double eval(
String expression , Hashtable htbl ) throws
cannotConvertException
public synchronized
double eval( String expression , String values )
throws cannotConvertException
Methods in Derive.class
public synchronized String[] diff(
String expression , String variables ) throws
notValidSyntaxException
public synchronized String[] diff( String
expression ) throws notValidSyntaxException