Add new package which allows anonymous lambda functions to be defined in expressions `x=>x^2`

.
The package adds higher order like `map`

and `fold`

which take lambda functions
as arguments. It also adds a range operator `[1..10]`

for easily specifying a range of numbers.

- Fix bugs with
`POperator`

`equalsPNode()`

and`compareTo()`

methods, less critical as most expressions are represented as Polynomials and not POperators. - Add
`equals()`

method to`AbstractPNode`

so it is consistent with`compareTo()`

. Add`hashCode()`

methods for all subtypes. - Fix bug with
`MrpEval`

when using expressions with more than 128 calls to binary functions which have non-scaler arguments. Now support up to 32767 separate vector arguments and 32767 separate matrix arguments. - Add a
`RationalDivisionPrintRule`

which fixes bug with printing expressions with rational constants. `MrpeEval.setVarVal(ref,double[])`

can set scaler variable to arrays of length 1.`Compare.process(Node node, Node children[])`

now uses the`children[]`

array rather than`node.jjtGetChild()`

. This prevented any symbolic operations being applied before comparison.- Fix bug with
`DimensionVisitor`

incorrectly calculated dimensions like`id(2,3)`

where the output dimensions depend on constant arguments.

`Dimensions`

class reworked to support vectors with 0 and 1 elements. Now a vector with 1 element is distinguished from a Scaler. The constant ONE and the method`valueOf(int)`

are deprecated. The constant SCALER, EMPTY_VECTOR, ONE_ELEMENT_VECTOR should be used instead, and the methods`valueOfVecOrScaler(int)`

and`valueOfVec(int)`

remove ambiguity. The method`valueOf(Dimensions,int)`

was buggy and is now fixed. String representation changed to distinguish scalers from vectors. The`DoubleVector`

and`GenericVector`

classes no allow zero length vectors. The`MatrixList`

class turns empty lists into zero length vectors.

`MrpeEval`

now has facilities to make it easier to use in multiple
threads. The `getLightWeightInstance()`

returns a new instance which can
be safely used for evaluation in multiple threads. This has copies of internal
data so the `evaluate(MrpCommandList)`

can be used with
a given command list.

Instances created in this way lose information about Jep variable.
Variable values
can be accessed using the `getVarValue(MrpVarRef ref)`

and the various `setVarValue(MrpVarRef ref, double d)`

methods.
But method using Jep `Variable`

, i.e.
`updateFromJepVariables()`

, `updateToJepVariables`

`getVariable(MrpVarRef ref)`

`getVarRef(String name)`

`getVarRef(Variable var)`

, do not work.

The instance also lose information about the matrix factory used to convert
vector and matrix results. So the methods `convertToVector(MrpRes res)`

`convertToMatrix(MrpRes res)`

and `convertResult(MrpRes res)`

don't work. But you can use the `MrpRes.copyToVec(VectorI)`

,
`MrpRes.copyToMat(MatrixI)`

and other methods of `MrpRes`

.

A second method `getLightWeightInstance(Jep jep)`

uses the Variable and MatrixFactory information from the new Jep instance. So the above
methods are safe to use.

The `RpEval`

class has similar methods. With and instance created
using `getLightWeightInstance()`

variable values can be accessed
using `getVarValue(int ref)`

and `setVarValue(int ref, double val)`

.
When using `getLightWeightInstance(Jep jep)`

references can be found using
`int getVarRef(Variable var)`

`int getVarRef(String name)`

.

Add a `chargeFunctionName(String oldname, String newname)`

method to `AbstractEval`

allowing alternative names for built in functions.

Add a `String toString(RpCommandList coms1)`

to `RpEval`

to print a more detailed
version of a command list.

The `RpEval`

, `MrpEval`

, `RpCommandList`

, `MrpCommandList`

and related classes are all Serializable.

General

- Rework
`OperatorTable`

and`FunctionTable`

classes to mirror Jep 4.0 release with`shallowCopy()`

methods. - More consistency in constructors of PFMC's. With constructors with XJep arguments and also zero argument constructors with delayed initialisation.

com.singularsys.extensions.xjep

- Change
`Xjep.recursiveGetVarsInEquation()`

to return a sorted list rather than a set. Order will be in evaluation order. - The
`TreeUtils`

class treats Integers and Complex numbers representing real integer values like double values with integer results. This allows correct simplification of expressions like`x^(Complex(1,0))`

. - Add
`Preprocess`

PFMC which causes the preprocessor to be run during evaluation. - Add
`Eval`

PFMC which evaluates is argument during preprocessing. - Fix handling of the
`XAssign.process()`

when the`UseEquation`

flag is not set or the left hand side is a`LValueI`

. - Add new
`DirtyFunction`

interface for PFMC's which should not be cleaned when all arguments are constants. Add new`DirtyRandom`

and`DirtyThreadSafeRandom`

PFMC's which implement the interface. Modify`ExpressionCleaner`

to respect interface. - Add new
`XFunctionTable`

which uses the`DirtyRandom`

PFMC.

com.singularsys.extensions.matrix

- Fix bug with
`GenericMatrix.equals(Object)`

, which failed for two different matrices with equal elements. Now uses`Arrays.deepEquals()`

- Add some getters for components of
`MatrixComponents`

. - Add the mean, sum, min, max functions from the com.singularsys.extensions.statistical package to
`MatrixFunctionTable`

. - Add several convenience method to
`DimensionVisitor`

:`visit(XVariable var)`

calculates the dimensions of a variable specified by an equation,`getDimensions(Variable var)`

and`getDimensions(Node node)`

find dimensions of existing objects which have already been calculated, and`calcVariableDimensionsByValue(Variable var)`

calculates its dimensions using its value. - The
`MatrixFactoryI`

now has a default method`VectorI zeroVec(Dimensions dim)`

to create a vector of a given size. - The
`MatrixFactory`

and`MatrixField`

classes now all return`this`

from the`getLightWeightInstance()`

method.s - LightWeight instances of all MatrixFactories and Fields return this.
- All the concrete Matrix and Vector types are Serializable. Base interfaces
`MatrixI, vectorI`

are not Serializable.

com.singularsys.extensions.matrixdiff

- Add some getters to reveal components of
`MDjep`

. - Fix the
`DDimensionVisitor`

to work with variables with equations and some edge cases.

com.singularsys.extensions.fastmatrix

`MrpEval`

has new constructor`MrpEval(Jep jep)`

which use a MatrixI factory taken from a Jep component.`MrpEval`

has methods`getLightWeightInstance(Jep newjep)`

which creates a thread safe copy using supplied Jep context.`MrpeEval.setVarVal(ref,double[])`

can set scaler variable to arrays of length 1.`MrpeEval.evaluate()`

now throws an`EvaluationException`

if the a PFMC called throws an Exception.`MrpRes`

and subclasses have a`toFlatternedArray()`

method which always returns a one dimensional array.`MrpRes`

methods`copyToVec(VectorI vec)`

and`copyToMat(MatrixI res)`

now return the supplied`VectorI`

or`MatrixI`

respectively.`MrpCommandList`

has a new`MrpCommand getCommand(int i)`

method.- Reduce visibility of some methods of internal classes of
`fastmatrix`

package.

com.singularsys.extensions.fastreal

`RpEval`

and`RpCommandList`

can both be serialised.- New
`updateFromJepVariables()`

methods to set variable values from the Jep instance.

com.singularsys.extensions.statistical

- Statistical functions now implement
`MatrixFunctionI`

so work with the Matrix package. - Add a Range operation to the
`ElementMinMax`

- For
`Mode`

add handling of cases where mode is not defined, returning NaN by default. - Add a base class for the Ranks and SortElements functions.

com.singularsys.extensions.djep

`DJep`

has new methods`replacePartialDerivativeByExpressions(Node)`

,`differentiate(DVariable var,String... names)`

.

com.singularsys.extensions.rewrite

- Allow
`RewriteVisitor`

to transform constant and variable nodes. Creates new interfaces`ConstantRuleI`

and`VariableRuleI`

for rules which perform these actions. - Add
`SmallNumberRule`

a constant rule which replaces small number with 0.0, useful for cleaning nodes. - Add
`VariableShifter`

which replaces a variable "x" by a shifted version e.g. "x+5"

com.singularsys.extensions.polynomial

- Allow
`SymbolicEquals`

PFMC. - Fix bug in
`Compare`

PFMC. - All types of
`PNodeI`

are serializable. - PolynomialCreator respects the
`DirtyFunction`

interface.

Major re-release to match the Jep 3.5 release.

All packages moved to the
`com.singularsys.extensions`

and reworked to use the Jep 3 framework.

- Field
`com.singularsys.extensions.field`

- Matrix
`com.singularsys.extensions.matrix`

- MathML
`com.singularsys.extensions.mathml`

- Structured programming
`com.singularsys.extensions.structure`

- fastreal
`org.lsmp.djep.rpe`

renamed to`com.singularsys.extensions.fastreal`

- fastmatrix
`org.lsmp.djep.mrpe`

renamed to`com.singularsys.extensions.fastmatrix`

- polynomials
`org.lsmp.djep.sjep`

renamed to`com.singularsys.extensions.polynomials`

**Printing:**equations can be easily printed or converted to strings with intelligent handling of brackets.**re-entrant parser****Utilities**for examining and modifying the parse trees

`groupJep`

replaced by Field package`com.singularsys.extensions.field`

`matrixJep`

and`vectorJep`

replaced by Matrix package`com.singularsys.extensions.matrix`

- Date and time functions.
- Summation type functions.

- Fixed bug [ 1567116 ] VectorJep division

**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.

- 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.

No major changes were made for the release.

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.

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.

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.

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.

- 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 lineif(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.