- JavaDoc

# JEP

- Introduction
- Basic Usage
- Variables
- Data types
- Operators
- Functions
- Custom Functions
- BigDecimal
- FAQ
- Migration
- Version History

# Advanced Features

- Manipulating Expressions
- Components
- Configurable Parser
- Serialization
- Grammar

# Extensions Version History

## Version 2.0 (released 2007/04/25)

### Extensions

The new Jep-extensions packages contain optional extensions to Jep.

com.singularsys.extensions.field,
  A flexible framework for overloading operators using custom datatypes
com.singularsys.extensions.matrix,
  Matrix classes, provides standard implementations and interfaces to use other matrix libraries
com.singularsys.extensions.fastreal,
  A fast real evaluator provides 5-10 fold speed improvement over the standard Jep. Limited to one dimensional real computation using doubles.
com.singularsys.extensions.mathml,
  Import/export to Content MathML.
com.singularsys.extensions.date,
  Date and time functions.
com.singularsys.extensions.structure,
  Structured programming, such as for-next loops, if-then-else.

## Version 1.1.1 (released 2007/04/25)

- Fixed bug [ 1567116 ] VectorJep division

## Version 1.1.0

### New Features

- Simplification: A new package org.lsmp.djep.sjep has a more advanced simplification algorithm. This will collect terms with the same powers so `3x+x^2+4x+x^2` is transformed to `7x+2x^2`. Full expansion of polynomials is also available so `(1+x)^3` it transformed to `1+3x+3x^2+x^3`.
- Fast Evaluation: Two new classes in the org.lsmp.djep.rpe package peform faster evaluation over the reals. The speed up can be between four and ten times faster. One of the classes RpEval works with singled valued functions and the other MRpEval works with vectors and matrices optimised for 2,3, and four dimensions.
- New Functions: Several new functions have been added, including standard vector and matrix operations and wrappers around the JAMA matrix algorithms which can solve matrix equations.

### Minor Improvments

- Evaluator now swithchable to allow null variable values.
- SymbolTable can now tell java.util.observers when new variables are created.
- Reworked Console aplications to make them easily extendable.
- Rewrite Visitor can allow arbitary term rewriting rules.
- XJep has methods to find the variables in an equation.

## Version 2.3.0 release (renamed to DJEP 1.0.0)

No major changes were made for the release.

## Version 2.3.0 beta 1 - 12 April 2004 (formerly known as 2.3.2 beta)

This version now has a stable API an should be used in preference to earlier versions.
Main changes since 2.3.0a:

- Added a groupJep package: this allows calculation over arbitrary groups like the rational numbers.
- Changed the org.nfunk.jep.values.Complex to extend number, modified all postfix math commands to suit.
- Changed the Scaler, MVector and Matrix types to extend number.
- Added features for a re-enterant parser.
- Major re-nameing of packages and classes. Removed unnecessary classes.
- Documentation updated.
- The ^ operator is now overloaded to be the cross product for 3D vectors as well as power.
- Parser is now switchable for whether . can appear in an identifier x.y can either be a single variable (default for Jep, XJep and DJep) or as the dot product x . y (default for VectorJep and MatrixJep).
- New functions if, str, complex, polar.
- Several other minor changes.

### Features yet to come

A few new functions to be added, min, max, sgn, differentiation for if.
Vector and matrix functions: det, inverse, transpose ....
Faster evaluation, possibly based of a reverse polish type of evaluation scheme, eliminating as much object creation as possible.
Various conversion routines to other formats MathML etc.

## Version 2.3.0 alpha - 28 Feb 2004 (formerly known as 2.3.1 alpha)

This is the third release of the package, released 28/Feb/04. I'm really just rushing this out as some people have been asking for documentation which is included here. Still more documentation to come. Also the code is still in a fairly mutable state and I still expect to move some things around so don't expect the the API to be stable. Hopefully it will just be the inner workings which change the main interface for users is nearly fixed. The most important changes in this package are

- Renames org.lsmp.djep.matrixJep.MatrixDJep to org.lsmp.djep.matrixJep.MatrixDJep.
- Moved the console applications to their own package
- Added some more examples
- Added some documentation
- Added some JUnit test
- Rationalised some of inner workings and cleaned up some unnecessary stuff, notably in relation to variables and their evaluation.

## Version 2.3.0a - Jan 04

First release as an official part of JEP.
Added support for vectors and matrices.
Major reworking of differentiation, functionality now split into two packages org.lsmp.djep.xjep - printing, tree manipulation etc, and org.lsmp.djep.djep - differentiation.
Changed the org.nfunk.jep.SymbolTable class so the elements are now of type org.nfunk.jep.Variable rather than just its value. ASTVarNodes now refer to the variable object.
Several changes in exposed API for JEP.
Introduced an org.nfunk.jep.Operator and org.nfunk.jep.OperatorSet types which represent the basic +,-,*,/,etc operators. Eliminates the excess creation of one object for each instance of an operator.

### Known bugs in version 2.3.0a

Several bugs are known in version 2.3.0a.

- Differential of "diff(a^x,x)" should be "a^x * ln(a)" but it's "a^x * ln(x)".
- Evaluation of "(x*x)*(x*x)" causes a ParseError in VectorJep and MatrixJep. Quick fix: edit org.lsmp.djep.vectorJep.function.MMultiply.java
  On line 72: in the run method, comment out the line

      if(stack.size()!=2) throw new ParseException("Multiply: should have two children its got "+stack.size());

- Matrix multiplication (i.e. matrix * matrix) does not work. Fix: upgrade to later version.
- vector * vector multiplication does not work.
- cannot combine results of matrix operations with functions ie. "sqrt([1,2].[1,2])" fails. Fix: upgrade.
- Dot and cross product cannot be differentiated.
- uminus is broken for MatrixJep.
- Problems repeated evaluation of sequences of equations.
  Quick fix: always uses before reevaluation. j.getSymbolTable().clearValues();
- Problems with using different types of JEP in the same application. They share a static Operator class which can have the wrong pfmc's for the type of JEP.

## First release

The first release of the package was about September last year. It just included differentiation facilities. The package has had a major rework since then.