java.lang.Object
org.bzdev.math.RealValuedFunctionVA
org.bzdev.math.RealValuedFunctionVA.Linear
- All Implemented Interfaces:
RealValuedFunctVAOps
,VADomainOps
- Enclosing class:
- RealValuedFunctionVA
Class representing a real-valued function of the form
f(x,β1,...) = ∑i βifi(x).
The function this class represents is a linear function of all its
arguments except the first. The functions in the sum are
sometimes called basis functions as they form the basis for a
vector space.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bzdev.math.RealValuedFunctionVA
RealValuedFunctionVA.Linear
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondouble
derivAt
(int i, double... args) Evaluate the partial derivative $\frac{\partial f}{\partial x_i}$ for a function f(x0,x1, ...).boolean
domainMaxClosed
(int argIndex) Determine if the domain maximum for the ith argument, when the arguments are in the domain of the function, is in the function's domain.boolean
domainMinClosed
(int argIndex) Determine if the domain minimum for the ith argument, when the arguments are in the domain of the function, is in the function's domain.getBasis()
Get the basis functions—the functions that will be combined linearly.double
getDomainMax
(int argIndex) Get the least upper bound of the ith argument when the arguments are in the domain of the function.double
getDomainMin
(int argIndex) Get the greatest lower bound of the ith argument when the arguments are in the domain of the function.double
secondDerivAt
(int i, int j, double... args) Evaluate the partial derivative $\frac{\partial^2 f}{\partial x_i \partial z_j}$ for a function f(x0,x1, ...).double
valueAt
(double... args) Call the function.Methods inherited from class org.bzdev.math.RealValuedFunctionVA
isInDomain, jacobian, jacobian, maxArgLength, minArgLength
-
Constructor Details
-
Linear
Constructor. The arguments are the basis functions. The basis functions must implement derivatives if this function's derivatives with respect to its first argument are to be evaluated.The number of double-precision arguments that should be passed to
valueAt(double...)
,derivAt(int,double...)
, andsecondDerivAt(int,int,double...)
will be the next integer larger than the number of arguments passed to this constructor. The first double-precision argument will be passed to the basis functions and the remainder will represent parameters for the basis functions, both in the same order as that used by this constructor.- Type Parameters:
T
- an interface that extendsRealValuedFunctOps
- Parameters:
args
- a non-zero number of real valued functions of one argument- Throws:
IllegalArgumentException
- an argument was null or no arguments were provided
-
-
Method Details
-
getBasis
Get the basis functions—the functions that will be combined linearly. These are the real-valued functions passed to the constructor, returned in the same order.- Returns:
- the basis functions
-
getDomainMin
Description copied from class:RealValuedFunctionVA
Get the greatest lower bound of the ith argument when the arguments are in the domain of the function. The implementation will either return the most negative double-precision number or the result of calling a method named getDomainMin (with the same arguments as this method) provided by an object created by a scripting language. If an object created via a scripting language is not passed to a constructor, and a different value is appropriate, this method should be overridden.- Specified by:
getDomainMin
in interfaceVADomainOps
- Overrides:
getDomainMin
in classRealValuedFunctionVA
- Parameters:
argIndex
- the index determining the argument for which this method applies (0th, 1st, ...)- Returns:
- the minimum value
- Throws:
IllegalArgumentException
- the argument is out of rangeIllegalStateException
- the function was not fully initialized.
-
getDomainMax
Description copied from class:RealValuedFunctionVA
Get the least upper bound of the ith argument when the arguments are in the domain of the function. The implementation will either return the largest double-precision number or the result of calling a method named getDomainMax (with the same arguments as this method) provided by an object created by a scripting language. If an object created via a scripting language is not passed to a constructor, and a different value is appropriate, this method should be overridden.- Specified by:
getDomainMax
in interfaceVADomainOps
- Overrides:
getDomainMax
in classRealValuedFunctionVA
- Parameters:
argIndex
- the index determining the argument for which this method applies (0th, 1st, ...)- Returns:
- the maximum value
- Throws:
IllegalArgumentException
- the argument is out of rangeIllegalStateException
- the function was not fully initialized.
-
domainMinClosed
Description copied from class:RealValuedFunctionVA
Determine if the domain minimum for the ith argument, when the arguments are in the domain of the function, is in the function's domain. The implementation will either return true or the result of calling a method named getDomainMinClosed (with the same arguments as this method) provided by an object created by a scripting language. If an object created via a scripting language is not passed to a constructor, and a different value is appropriate, this method should be overridden.- Specified by:
domainMinClosed
in interfaceVADomainOps
- Overrides:
domainMinClosed
in classRealValuedFunctionVA
- Parameters:
argIndex
- the index determining the argument for which this method applies (0th, 1st, ...)- Returns:
- true if the domain minimum is in the domain; false if it is the greatest lower bound for the domain
- Throws:
IllegalArgumentException
- the argument is out of rangeIllegalStateException
- the function was not fully initialized.
-
domainMaxClosed
Description copied from class:RealValuedFunctionVA
Determine if the domain maximum for the ith argument, when the arguments are in the domain of the function, is in the function's domain. The implementation will either return true or the result of calling a method named getDomainMaxClosed (with the same arguments as this method) provided by an object created by a scripting language. If an object created via a scripting language is not passed to a constructor, and a different value is appropriate, this method should be overridden.- Specified by:
domainMaxClosed
in interfaceVADomainOps
- Overrides:
domainMaxClosed
in classRealValuedFunctionVA
- Parameters:
argIndex
- the index determining the argument for which this method applies (0th, 1st, ...)- Returns:
- true if the domain maximum is in the domain; false if it is the least upper bound for the domain
- Throws:
IllegalArgumentException
- the argument is out of rangeIllegalStateException
- the function was not fully initialized.
-
valueAt
public double valueAt(double... args) throws IllegalArgumentException, UnsupportedOperationException, IllegalStateException Description copied from class:RealValuedFunctionVA
Call the function.- Specified by:
valueAt
in interfaceRealValuedFunctVAOps
- Overrides:
valueAt
in classRealValuedFunctionVA
- Parameters:
args
- the function's arguments- Returns:
- the value of the function for the given arguments
- Throws:
IllegalArgumentException
- the function's argument(s) were out of rangeUnsupportedOperationException
- the operation is not supported.IllegalStateException
- the function was not fully initialized.
-
derivAt
public double derivAt(int i, double... args) throws IllegalArgumentException, UnsupportedOperationException, IllegalStateException Description copied from class:RealValuedFunctionVA
Evaluate the partial derivative $\frac{\partial f}{\partial x_i}$ for a function f(x0,x1, ...).- Overrides:
derivAt
in classRealValuedFunctionVA
- Parameters:
i
- the index indicating that the partial derivative is computed for the ith argument, numbered from zeroargs
- the function f's arguments- Returns:
- the value of the partial derivative for the given argument
- Throws:
IllegalArgumentException
- the function's argument(s) were out of rangeUnsupportedOperationException
- the operation is not supported.IllegalStateException
- the function was not fully initialized.
-
secondDerivAt
public double secondDerivAt(int i, int j, double... args) throws IllegalArgumentException, UnsupportedOperationException, IllegalStateException Description copied from class:RealValuedFunctionVA
Evaluate the partial derivative $\frac{\partial^2 f}{\partial x_i \partial z_j}$ for a function f(x0,x1, ...).- Overrides:
secondDerivAt
in classRealValuedFunctionVA
- Parameters:
i
- the index indicating that the partial derivative is computed for the ith argument, numbered from 0j
- the index indicating that the partial derivative is computed for the jth argument, numbered from 0args
- the function f's arguments- Returns:
- the value of the partial derivative $\frac{\partial^2 f}{\partial x_i \partial z_j}$ for the given arguments x0, x1, ...
- Throws:
IllegalArgumentException
- the function's arguments were out of rangeUnsupportedOperationException
- the operation is not supported.IllegalStateException
- the function was not fully initialized.
-