JScience v4.3

Package org.jscience.mathematics.function

Provides support for fairly simple symbolic math analysis (to solve algebraic equations, integrate, differentiate, calculate expressions, and so on).

See:
          Description

Interface Summary
Interpolator<P,V> This interface represents an estimator of the values at a certain point using surrounding points and values.
Variable<X> This interface represents a symbol on whose value a Function depends.
 

Class Summary
Constant<R extends Ring<R>> This class represents a constant function (polynomial of degree 0).
DiscreteFunction<X,Y> This class represents a function defined from a mapping betweem two sets (points and values).
Function<X,Y> This abstract class represents a mapping between two sets such that there is a unique element in the second set assigned to each element in the first set.
Interpolator.Linear<F extends Field<F>> This class represents a linear interpolator for field instances (point and values from the same field).
Polynomial<R extends Ring<R>> This class represents a mathematical expression involving a sum of powers in one or more variables multiplied by coefficients (such as x² + x·y + 3y²).
RationalFunction<F extends Field<F>> This class represents the quotient of two Polynomial, it is also a field (invertible).
Term This class represents the term of a polynomial such as x·y².
Variable.Global<X> This class represents a simple Variable implementation with context-local values.
Variable.Local<X> This class represents a simple Variable implementation for functions not shared between threads (non static).
 

Exception Summary
FunctionException Thrown when a function operation cannot be performed.
 

Package org.jscience.mathematics.function Description

Provides support for fairly simple symbolic math analysis (to solve algebraic equations, integrate, differentiate, calculate expressions, and so on).

Functions defined in this package can be multivariate and operate on various kind of objects such as physical measurements, vectors, matrices, all types of numbers or even the functions themselves (functions of functions)! Here is an example using complex polynomial functions:


        // Defines two local variables (x, y).
        Variable<Complex> varX = new Variable.Local<Complex>("x");
        Variable<Complex> varY = new Variable.Local<Complex>("y");

        // f(x) = ix² + 2x + 1
        Polynomial<Complex> x = Polynomial.valueOf(Complex.ONE, varX);
        Polynomial<Complex> fx = x.pow(2).times(Complex.I).plus(
            x.times(Complex.valueOf(2, 0)).plus(Complex.ONE));
        System.out.println(fx);
        System.out.println(fx.pow(2));
        System.out.println(fx.differentiate(varX));
        System.out.println(fx.integrate(varY));
        System.out.println(fx.compose(fx));

        // Calculates expression.
        varX.set(Complex.valueOf(2, 3)); 
        System.out.println(fx.evaluate());

       > [0.0 + 1.0i]x^2 + [2.0 + 0.0i]x + [1.0 + 0.0i]
       > [-1.0 + 0.0i]x^4 + [0.0 + 4.0i]x^3 + [4.0 + 2.0i]x^2 + [4.0 + 0.0i]x + [1.0 + 0.0i]
       > [0.0 + 2.0i]x + [2.0 + 0.0i]
       > [0.0 + 1.0i]x^2y + [2.0 + 0.0i]xy + [1.0 + 0.0i]y
       > [0.0 - 1.0i]x^4 + [-4.0 + 0.0i]x^3 + [-2.0 + 6.0i]x^2 + [4.0 + 4.0i]x + [3.0 + 1.0i]
       > -7.0 + 1.0i
       


JScience v4.3

Copyright © 2006 JScience.