Interface Func.Updatable

All Superinterfaces:
Func
All Known Implementing Classes:
InverseNumberFunc.Updatable, LinearFunc.Updatable, PowerFunc.Updatable
Enclosing interface:
Func

public static interface Func.Updatable extends Func

"Updatable" mathematical function: an extension of Func interface allowing assigning values to the function result, that leads to corresponding correction of arguments. Usually can be implemented for one-argument functions, where the set(x[], newResult) method assigns to x[0] the result of the inverse function, called for newResult.

Implementations of this interface are usually immutable and always thread-safe: get and set methods of this interface may be freely used while simultaneous accessing the same instance from several threads.

  • Method Details

    • set

      void set(double[] x, double newResult)
      Correct some of x arguments so that get(x) will be, as possible, equal to newResult. For example, if this is one-argument function f(x), and its inverse function is g(y) (g(f(x))=x), then this method should assign x[0]=g(newResult).

      This method does not guarantee the precise equality get(x)==newResult. (Usually, it is impossible due to limited precision of floating-point calculations.) But this method should try to provide this equality (after its call) with, as possible, maximal possible precision.

      Parameters:
      x - the function arguments.
      newResult - the desired function result.
      Throws:
      IndexOutOfBoundsException - may be thrown if the length of x array is less than the required number of this function arguments.