JADE v6.1

Package com.dautelle.math.functions

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

See:
          Description

Class Summary
Constant This class represents a constant function (polynomial of degree 0).
DiscreteFunction This class represents a function being actually defined from a mapping between two sets.
Function 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.
Function.Variable This class represents a symbol on whose value a Function depends.
Polynomial 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²).
Polynomial.Term This class represents the term of a polynomial such as x·y².
RationalFunction This class represents the quotient of two Polynomial.
 

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

Package com.dautelle.math.functions 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 any kind of Operable element such as physical quantities, matrices, all types of numbers or even the functions themselves (functions of functions)! Here is an example using complex polynomial functions:


        // f(x) = 1 + 2x + ix²
        Polynomial x = Polynomial.valueOf(Complex.ONE, Variable.X);
        Constant one = Constant.valueOf(Complex.ONE);
        Constant two = Constant.valueOf(Complex.valueOf(2, 0));
        Constant i = Constant.valueOf(Complex.I);
        Polynomial fx = (Polynomial) one.plus(two.times(x)).plus(i.times(x.pow(2)));

        System.out.println(fx);
        System.out.println(fx.pow(2));
        System.out.println(fx.differentiate(Variable.X));
        System.out.println(fx.integrate(Variable.Y));
        System.out.println(fx.compose(fx));

        // Calculates expression.
        Variable.X.setValue(Complex.valueOf(2, 3)); // Context local
        System.out.println(fx.evaluate());

       > [1.0 + 0.0i] + [2.0 + 0.0i]x + [0.0 + 1.0i]x²
       > [1.0 + 0.0i] + [4.0 + 0.0i]x + [4.0 + 2.0i]x² + [0.0 + 4.0i]x³ + [-1.0 + 0.0i]x4
       > [2.0 + 0.0i] + [0.0 + 2.0i]x
       > [1.0 + 0.0i]y + [2.0 + 0.0i]xy + [0.0 + 1.0i]x²y
       > [3.0 + 1.0i] + [4.0 + 4.0i]x + [-2.0 + 6.0i]x² + [-4.0 + 0.0i]x³ + [0.0 - 1.0i]x4
       > -7.0 + 1.0i
       


JADE v6.1

Copyright © 2004 Jean-Marie Dautelle.