- All Implemented Interfaces:
RealValuedFunctThreeOps
,RealValuedFunctVAOps
,VADomainOps
This is intended for cases in which a function should be passed as an argument.
A subclass will typically override one or more of the methods valueAt, deriv1At, deriv2At, deriv3At, deriv11At, deriv12At, deriv13At, deriv21At, deriv22At, deriv23At, deriv31At, deriv32At, and deriv33At to provide the values for a function and its first and second partial derivative. For any that are not available, an UnsupportedOperationException will be thrown.
The class also provides scripting-language support. If a Scripting
context is named scripting
, the following EMCAScript
code will implement a function and its derivatives:
Alternatively, one may use the following code where the functions defining the derivatives are provided by name:importClass(org.bzdev.RealValuedFunctionThree); .... // assume ourObject is a Java class with a method setFunction // that takes a RealValuedFunctionThree as its argument. funct = new RealValuedFunctionThree(scripting, {valueAt: function(x,y,z) {return Math.sin(x)*Math.cos(y)*z;}, deriv1At: function(x,y,z) {return Math.cos(x)*Math.cos(y)*z;}, deriv2At: function(x,y,z) { return -Math.sin(x)*Math.sin(y)*z; }, deriv3At: function(x,y,z) {return Math.sin(x) * Math.cos(y);}, deriv11At: function(x,y,z) { return -Math.sin(x) * Math.cos(y) * z; }, deriv12At: function(x,y,z) { return -Math.cos(x) * Math.sin(y) * z; }, deriv13At: function(x,y,z) {return Math.cos(x)*Math.sin(y);}, deriv21At: function(x,y,z) { return -Math.cos(x) * Math.sin(y) * z; }, deriv22At: function(x,y,z) { return -Math.sin(x) * Math.cos(y) * z;} deriv23At: function(x,y,z) { return -Math.sin(x) * Math.sin(y); } deriv31At: function(x,y,z) { return Math.cos(x) * Math.cos(y); }, deriv32At: function(x,y,z) { return -Math.sin(x) * Math.sin(y); }, deriv33At: function(x,y,z) {return 0.0;} }; ourObject.setFunction(funct);
importClass(org.bzdev.RealValuedFunctionThree); ... function f(x,y,z) {return Math.sin(x) * Math.cos(y) * z;} function f1(x,y,z) {return Math.cos(x) * Math.cos(y) * z;} function f2(x,y,z) {return -Math.sin(x) * Math.sin(y) * z;} function f3(x,y,z) {return Math.sin(x) * Math.cos(y);} function f11(x,y,z) {return -Math.sin(x) * Math.cos(y) * z;} function f12(x,y,z) {return -Math.cos(x) * Math.sin(y) * z;} function f13(x,y,z) {return Math.cos(x) * Math.cos(y);} function f21(x,y,z) {return -Math.cos(x) * Math.sin(y) * z;} function f22(x,y,z) {return -Math.sin(x) * Math.cos(y) * z;} function f23(x,y,z) {return -Math.sin(x) * Math.sin(y);} function f31(x,y,z) {return Math.cos(x) * Math.cos(y)} function f32(x,y,z) {return -Math.sin(x) * Math.sin(y);} function f33(x,y,z) {return 0.0;} ... // assume ourObject is a Java class with a method setFunction // that takes a RealValuedFunction as its argument. funct = new RealValuedFunction(scripting, "f", "f1", "f2", "f3" "f11", "f12", "f13", "f21", "f22", "f23", "f31", "f32", "f33"); ourObject.setFunction(funct);
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bzdev.math.RealValuedFunctionVA
RealValuedFunctionVA.Linear
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor.Constructor given a function.RealValuedFunctionThree
(RealValuedFunctThreeOps function, RealValuedFunctThreeOps function1, RealValuedFunctThreeOps function2, RealValuedFunctThreeOps function3) Constructor given a function and its first partial derivatives.RealValuedFunctionThree
(RealValuedFunctThreeOps function, RealValuedFunctThreeOps function1, RealValuedFunctThreeOps function2, RealValuedFunctThreeOps function3, RealValuedFunctThreeOps function11, RealValuedFunctThreeOps function12, RealValuedFunctThreeOps function13, RealValuedFunctThreeOps function21, RealValuedFunctThreeOps function22, RealValuedFunctThreeOps function23, RealValuedFunctThreeOps function31, RealValuedFunctThreeOps function32, RealValuedFunctThreeOps function33) Constructor given a function and its first and second partial derivatives.RealValuedFunctionThree
(ScriptingContext scriptingContext, Object object) Constructor when the function is provided by a script object.RealValuedFunctionThree
(ScriptingContext scriptingContext, String fname, String f1name, String f2name, String f3name) Constructor when the function and its first derivatives are provided by functions defined in scripts.RealValuedFunctionThree
(ScriptingContext scriptingContext, String fname, String f1name, String f2name, String f3name, String f11name, String f12name, String f13name, String f21name, String f22name, String f23name, String f31name, String f32name, String f33name) Constructor when the function and its first and second derivatives are provided by functions defined in scripts. -
Method Summary
Modifier and TypeMethodDescriptionfinal RealValuedFunctThreeOps
deriv
(int i) Get a function that computes the value of partial derivative that would be computed by callingderivAt(int,double...)
.deriv1()
Get a function computing $\frac{\partial f}{\partial x_1}$.deriv11()
Get a function that computes $\frac{\partial^2 f}{\partial x_1^2}$ where f is this function.double
deriv11At
(double arg1, double arg2, double arg3) Evaluate the partial derivative $\frac{\partial^2 f}{\partial x_1^2}$ for a function f(x1x2).deriv12()
Get a function that computes $\frac{\partial^2 f}{\partial x_1 \partial x_2}$ where f is this function.double
deriv12At
(double arg1, double arg2, double arg3) Evaluate the partial derivative $\frac{\partial^2 f}{\partial x_1 \partial x_2}$ where f is this function.deriv13()
Get a function that computes $\frac{\partial^2 f}{\partial x_1 \partial x_3}$ where f is this function.double
deriv13At
(double arg1, double arg2, double arg3) Evaluate the partial derivative $\frac{\partial^2 f}{\partial x_1 \partial x_3}$ for a function f(x1x2).double
deriv1At
(double arg1, double arg2, double arg3) Evaluate the partial derivative $\frac{\partial f}{\partial x_1}$ for a function f(x1x2).deriv2()
Get a function computing $\frac{\partial f}{\partial x_2}$.deriv21()
Get a function that computes $\frac{\partial^2 f}{\partial x_2 \partial x_1}$ where f is this function.double
deriv21At
(double arg1, double arg2, double arg3) Evaluate the partial derivative $\frac{\partial^2 f}{\partial x_2 \partial x_1}$ for a function f(x1x2).deriv22()
Get a function that computes $\frac{\partial^2 f}{\partial x_2^2}$ where f is this function.double
deriv22At
(double arg1, double arg2, double arg3) Evaluate the partial derivative $\frac{\partial^2 f}{\partial x_2^2}$ for a function f(x1x2).deriv23()
Get a function that computes $\frac{\partial^2 f}{\partial x_2 \partial x_3}$ where f is this function.double
deriv23At
(double arg1, double arg2, double arg3) Evaluate the partial derivative $\frac{\partial^2 f}{\partial x_2 \partial x_3}$ for a function f(x1x2).double
deriv2At
(double arg1, double arg2, double arg3) Evaluate the partial derivative $\frac{\partial f}{\partial x_2}$ for a function f(x2x2).deriv3()
Get a function computing $\frac{\partial f}{\partial x_3}$.deriv31()
Get a function that computes $\frac{\partial^2 f}{\partial x_3 \partial x_1}$ where f is this function.double
deriv31At
(double arg1, double arg2, double arg3) Evaluate the partial derivative $\frac{\partial^2 f}{\partial x_3 \partial x_1}$ for a function f(x1x2).deriv32()
Get a function that computes $\frac{\partial^2 f}{\partial x_3 \partial x_2}$ where f is this function.double
deriv32At
(double arg1, double arg2, double arg3) Evaluate the partial derivative $\frac{\partial^2 f}{\partial x_3 \partial x_2}$ for a function f(x1x2).deriv33()
Get a function that computes $\frac{\partial^2 f}{\partial x_3^2}$ where f is this function.double
deriv33At
(double arg1, double arg2, double arg3) Evaluate the partial derivative $\frac{\partial^2 f}{\partial x_3^2}$ for a function f(x1x2).double
deriv3At
(double arg1, double arg2, double arg3) Evaluate the partial derivative $\frac{\partial f}{\partial x_3}$ for the function f(x1,x2,x3).final double
derivAt
(int i, double... args) Evaluate the partial derivative $\frac{\partial f}{\partial x_i}$ for a function f(x0,x1, ...).boolean
Determine if the domain maximum for the first argument is in the domain.boolean
Determine if the domain maximum for the second argument is in the domain.boolean
Determine if the domain maximum for the third argument is in the domain.final boolean
domainMaxClosed
(int i) 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
Determine if the domain minimum for the first argument is in the domain.boolean
Determine if the domain minimum for the second argument is in the domain.boolean
Determine if the domain minimum for the third argument is in the domain.final boolean
domainMinClosed
(int i) 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.final double
getDomainMax
(int i) Get the least upper bound of the ith argument when the arguments are in the domain of the function.double
Get the maximum value of the first argument in the domain of the function.double
Get the maximum value of the second argument in the domain of the function.double
Get the maximum value of the third argument in the domain of the function.final double
getDomainMin
(int i) Get the greatest lower bound of the ith argument when the arguments are in the domain of the function.double
Get the minimum value of the first argument in the domain of the function.double
Get the minimum value of the second argument in the domain of the function.double
Get the minimum value of the third argument in the domain of the function.final boolean
isInDomain
(double... args) Determine if a point is within the domain of this function.boolean
isInDomain
(double x, double y, double z) Determine if a point (x, y) is within the domain of a real-valued function of two arguments.final RealValuedFunctThreeOps
secondDeriv
(int i, int j) Get a function that computes the value of partial derivative that would be computed by callingsecondDerivAt(int,int,double...)
.final 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, ...).final double
valueAt
(double... args) Call the function.double
valueAt
(double arg1, double arg2, double arg3) Call the function.Methods inherited from class org.bzdev.math.RealValuedFunctionVA
jacobian, jacobian, maxArgLength, minArgLength
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.bzdev.math.RealValuedFunctThreeOps
maxArgLength, minArgLength
-
Constructor Details
-
RealValuedFunctionThree
public RealValuedFunctionThree()Constructor. -
RealValuedFunctionThree
Constructor given a function. The argument implementsRealValuedFunctThreeOps
and can be a lambda expression with three arguments. The interfaceRealValuedFunctThreeOps
provides a single method:RealValuedFunctThreeOps.valueAt(double,double,double)
that, when called, provides the function's value.- Parameters:
function
- the function
-
RealValuedFunctionThree
public RealValuedFunctionThree(RealValuedFunctThreeOps function, RealValuedFunctThreeOps function1, RealValuedFunctThreeOps function2, RealValuedFunctThreeOps function3) Constructor given a function and its first partial derivatives. The arguments implementRealValuedFunctThreeOps
and can be a lambda expression with three arguments. The interfaceRealValuedFunctThreeOps
provides a single method:RealValuedFunctThreeOps.valueAt(double,double,double)
that, when called, provides the function's value.- Parameters:
function
- the function; null if not providedfunction1
- the function that provides the value for thederiv1At(double,double,double)
; null if this partial derivative is not defined.function2
- the function that provides the value for thederiv2At(double,double,double)
; null if this partial derivative is not defined.function3
- the function that provides the value for thederiv3At(double,double,double)
; null if this partial derivative is not defined.
-
RealValuedFunctionThree
public RealValuedFunctionThree(RealValuedFunctThreeOps function, RealValuedFunctThreeOps function1, RealValuedFunctThreeOps function2, RealValuedFunctThreeOps function3, RealValuedFunctThreeOps function11, RealValuedFunctThreeOps function12, RealValuedFunctThreeOps function13, RealValuedFunctThreeOps function21, RealValuedFunctThreeOps function22, RealValuedFunctThreeOps function23, RealValuedFunctThreeOps function31, RealValuedFunctThreeOps function32, RealValuedFunctThreeOps function33) Constructor given a function and its first and second partial derivatives. The arguments implementRealValuedFunctThreeOps
and can be a lambda expression with three arguments. The interfaceRealValuedFunctThreeOps
provides a single method:RealValuedFunctThreeOps.valueAt(double,double,double)
that, when called, provides the function's value.- Parameters:
function
- the function; null if not providedfunction1
- the function that provides the value for thederiv1At(double,double,double)
; null if this partial derivative is not defined.function2
- the function that provides the value for thederiv2At(double,double,double)
; null if this partial derivative is not defined.function3
- the function that provides the value for thederiv3At(double,double,double)
; null if this partial derivative is not defined.function11
- the function that provides the value for thederiv11At(double,double,double)
; null if this partial derivative is not defined.function12
- the function that provides the value for thederiv21At(double,double,double)
; null if this partial derivative is not defined.function13
- the function that provides the value for thederiv13At(double,double,double)
; null if this partial derivative is not defined.function21
- the function that provides the value for thederiv21At(double,double,double)
; null if this partial derivative is not defined.function22
- the function that provides the value for thederiv22At(double,double,double)
; null if this partial derivative is not defined.function23
- the function that provides the value for thederiv23At(double,double,double)
; null if this partial derivative is not defined.function31
- the function that provides the value for thederiv31At(double,double,double)
; null if this partial derivative is not defined.function32
- the function that provides the value for thederiv32At(double,double,double)
; null if this partial derivative is not defined.function33
- the function that provides the value for thederiv33At(double,double,double)
; null if this partial derivative is not defined.
-
RealValuedFunctionThree
Constructor when the function is provided by a script object. The parameter 'object' is expected to be either an instance of RealValuedFunctionThree or an object defined by a scripting language with methods named "valueAt", "deriv1At" "deriv2At", "deriv11At", "deriv12At", deriv21At", and "deriv22At". Each of these methods takes two arguments, both real numbers, and returns a number. For a real-valued function f(x1,x2), these methods are defined as follows:valueAt
returns f(x1,x2).deriv1At
returns $\frac{\partial f}{\partial x_1}$ evaluated at the point (x1,x2,x3).deriv2At
returns $\frac{\partial f}{\partial x_2}$ evaluated at the point (x1,x2,x3).deriv3At
returns $\frac{\partial f}{\partial x_3}$ evaluated at the point (x1,x2,x3).deriv11At
returns $\frac{\partial^2 f}{\partial x_1^2}$ evaluated at the point (x1,x2,x3).deriv12At
returns $\frac{\partial^2 f}{\partial x_1 \partial x_2}$ evaluated at the point (x1,x2,x3).deriv13At
returns $\frac{\partial^2 f}{\partial x_1 \partial x_3}$ evaluated at the point (x1,x2,x3).deriv21At
returns $\frac{\partial^2 f}{\partial x_2 \partial x_1}$ evaluated at the point (x1,x2).deriv22At
returns $\frac{\partial^2 f}{\partial x_2^2}$ evaluated at the point (x1,x2,x3).deriv23At
returns $\frac{\partial^2 f}{\partial x_2 \partial x_3}$ evaluated at the point (x1,x2,x3).deriv31At
returns $\frac{\partial^2 f}{\partial x_3 \partial x_1}$ evaluated at the point (x1,x2,x3).deriv32At
returns $\frac{\partial^2 f}{\partial x_3 \partial x_2}$ evaluated at the point (x1,x2,x3).deriv33At
returns $\frac{\partial^2 f}{\partial x_3^2}$ evaluated at the point (x1,x2,x3).
- Parameters:
scriptingContext
- the scripting contextobject
- an object from a scripting environment defining the methods defined above or a subset of those methods
-
RealValuedFunctionThree
public RealValuedFunctionThree(ScriptingContext scriptingContext, String fname, String f1name, String f2name, String f3name) Constructor when the function and its first derivatives are provided by functions defined in scripts. The script functions are expected to define up to three functions, and their names are used as the arguments for this method.- Parameters:
scriptingContext
- the scripting contextfname
- the name of a scripting-language function of three arguments; null if the valueAt method is not supportedf1name
- the name of a scripting-language function of three arguments providing the desired function's first derivative with respect to the first argument; null if the deriv1At method is not supportedf2name
- the name of a scripting-language function of three arguments providing the desired function's first derivative with respect to the second argument; null if the deriv2At method is not supportedf3name
- the name of a scripting-language function of three arguments providing the desired function's first derivative with respect to the third argument; null if the deriv3At method is not supported
-
RealValuedFunctionThree
public RealValuedFunctionThree(ScriptingContext scriptingContext, String fname, String f1name, String f2name, String f3name, String f11name, String f12name, String f13name, String f21name, String f22name, String f23name, String f31name, String f32name, String f33name) Constructor when the function and its first and second derivatives are provided by functions defined in scripts. The script functions are expected to define up to three functions, and their names are used as the arguments for this method.- Parameters:
scriptingContext
- the scripting contextfname
- the name of a scripting-language function of three arguments; null if the valueAt method is not supportedf1name
- the name of a scripting-language function of three arguments providing the desired function's first derivative with respect to the first argument; null if the deriv1At method is not supportedf2name
- the name of a scripting-language function of three arguments providing the desired function's first derivative with respect to the second argument; null if the deriv2At method is not supportedf3name
- the name of a scripting-language function of three arguments providing the desired function's first derivative with respect to the third argument; null if the deriv3At method is not supportedf11name
- the name of the scripting-language function of three arguments providing the value forderiv11At(double,double,double)
.f12name
- the name of the scripting-language function of three arguments providing the value forderiv12At(double,double,double)
.f13name
- the name of the scripting-language function of three arguments providing the value forderiv13At(double,double,double)
.f21name
- the name of the scripting-language function of three arguments providing the value forderiv21At(double,double,double)
.f22name
- the name of the scripting-language function of three arguments providing the value forderiv22At(double,double,double)
.f23name
- the name of the scripting-language function of three arguments providing the value forderiv23At(double,double,double)
.f31name
- the name of the scripting-language function of three arguments providing the value forderiv31At(double,double,double)
.f32name
- the name of the scripting-language function of three arguments providing the value forderiv32At(double,double,double)
.f33name
- the name of the scripting-language function of three arguments providing the value forderiv33At(double,double,double)
.
-
-
Method Details
-
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:
i
- 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:
i
- 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:
i
- 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:
i
- 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.
-
getDomainMin1
Get the minimum value of the first argument in the domain of the function.- Returns:
- the minimum value
- Throws:
IllegalStateException
- the function was not fully initialized.
-
getDomainMax1
Get the maximum value of the first argument in the domain of the function.- Returns:
- the maximum value
- Throws:
IllegalStateException
- the function was not fully initialized.
-
getDomainMin2
Get the minimum value of the second argument in the domain of the function.- Returns:
- the minimum value
- Throws:
IllegalStateException
- the function was not fully initialized.
-
getDomainMax2
Get the maximum value of the second argument in the domain of the function.- Returns:
- the maximum value
- Throws:
IllegalStateException
- the function was not fully initialized.
-
getDomainMin3
Get the minimum value of the third argument in the domain of the function.- Returns:
- the minimum value
- Throws:
IllegalStateException
- the function was not fully initialized.
-
getDomainMax3
Get the maximum value of the third argument in the domain of the function.- Returns:
- the maximum value
- Throws:
IllegalStateException
- the function was not fully initialized.
-
domainMin1Closed
Determine if the domain minimum for the first argument is in the domain.- Returns:
- true if the domain minimum is in the domain; false if it is the greatest lower bound for the domain
- Throws:
IllegalStateException
- the function was not fully initialized.
-
domainMax1Closed
Determine if the domain maximum for the first argument is in the domain.- Returns:
- true if the domain maximum is in the domain; false if it is the least upper bound for the domain
- Throws:
IllegalStateException
- the function was not fully initialized.
-
domainMin2Closed
Determine if the domain minimum for the second argument is in the domain.- Returns:
- true if the domain minimum is in the domain; false if it is the greatest lower bound for the domain
- Throws:
IllegalStateException
- the function was not fully initialized.
-
domainMax2Closed
Determine if the domain maximum for the second argument is in the domain.- Returns:
- true if the domain maximum is in the domain; false if it is the least upper bound for the domain
- Throws:
IllegalStateException
- the function was not fully initialized.
-
domainMin3Closed
Determine if the domain minimum for the third argument is in the domain.- Returns:
- true if the domain minimum is in the domain; false if it is the greatest lower bound for the domain
- Throws:
IllegalStateException
- the function was not fully initialized.
-
domainMax3Closed
Determine if the domain maximum for the third argument is in the domain.- Returns:
- true if the domain maximum is in the domain; false if it is the least upper bound for the domain
- Throws:
IllegalStateException
- the function was not fully initialized.
-
isInDomain
public final boolean isInDomain(double... args) throws UnsupportedOperationException, IllegalArgumentException, IllegalStateException Description copied from class:RealValuedFunctionVA
Determine if a point is within the domain of this function.The default behavior of this method assumes the domain is a rectangular region and uses the methods
RealValuedFunctionVA.getDomainMin(int)
,RealValuedFunctionVA.getDomainMax(int)
,RealValuedFunctionVA.domainMinClosed(int)
,RealValuedFunctionVA.domainMaxClosed(int)
, to determine if the arguments represent a point in the functions domain. If the domain is not rectangular with each side either in or not in the domain, then this method must be overridden. If it is not possible with a reasonable amount of computation to determine that a point is in the domain, an UnsupportedOperationException may be thrown. If this exception is thrown, it should be thrown regardless of the arguments.- Specified by:
isInDomain
in interfaceVADomainOps
- Overrides:
isInDomain
in classRealValuedFunctionVA
- Parameters:
args
- the arguments (x0,x1,...) giving the coordinates of a point- Returns:
- true if the point (x0,x1,...) is in this function's domain; false otherwise
- Throws:
UnsupportedOperationException
- domain membership could not be determined.IllegalArgumentException
- an argument is out of rangeIllegalStateException
- the function was not fully initialized.
-
isInDomain
public boolean isInDomain(double x, double y, double z) throws UnsupportedOperationException, IllegalStateException Determine if a point (x, y) is within the domain of a real-valued function of two arguments.The default behavior of this method assumes the domain is a rectangular region and uses the methods
getDomainMin1()
,getDomainMin2()
,getDomainMax1()
,getDomainMax2()
domainMin1Closed()
,domainMin2Closed()
,domainMax1Closed()
, anddomainMax2Closed()
to determine if the arguments represent a point in the functions domain. If the domain is not rectangular with each side either in or not in the domain, then this method must be overridden. If it is not possible with a reasonable amount of computation to determine that a point is in the domain, an UnsupportedOperationException may be thrown. If this exception is thrown, it should be thrown regardless of the arguments.- Parameters:
x
- the 1st coordinatey
- the 2nd coordinatez
- the 3rd coordinate- Returns:
- true if the point (x, y) is in this function's domain; false otherwise
- Throws:
UnsupportedOperationException
- domain membership could not be determined.IllegalStateException
-
valueAt
public final double valueAt(double... args) throws IllegalArgumentException, UnsupportedOperationException Description copied from class:RealValuedFunctionVA
Call the function.- Specified by:
valueAt
in interfaceRealValuedFunctThreeOps
- 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.
-
valueAt
public double valueAt(double arg1, double arg2, double arg3) throws IllegalArgumentException, UnsupportedOperationException, IllegalStateException Call the function.- Specified by:
valueAt
in interfaceRealValuedFunctThreeOps
- Parameters:
arg1
- the function's first argumentarg2
- the function's second argumentarg3
- the function's third argument- 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.
-
deriv
Get a function that computes the value of partial derivative that would be computed by callingderivAt(int,double...)
.- Parameters:
i
- the index of the argument (0 for the first argument, 1 for the second, etc.)- Returns:
- the function
-
derivAt
public final double derivAt(int i, double... args) throws IllegalArgumentException, UnsupportedOperationException, IllegalStateException Evaluate the partial derivative $\frac{\partial f}{\partial x_i}$ for a function f(x0,x1, ...).This method calls a method named deriv
<
i+1>
At(...) where i is the value of the first argument. One should usually override those methods instead of this one.- 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.
-
deriv1
Get a function computing $\frac{\partial f}{\partial x_1}$.- Returns:
- a function that computes $\frac{\partial f}{\partial x_1}$ where f is this real-valued function
-
deriv1At
public double deriv1At(double arg1, double arg2, double arg3) throws IllegalArgumentException, UnsupportedOperationException, IllegalStateException Evaluate the partial derivative $\frac{\partial f}{\partial x_1}$ for a function f(x1x2).- Parameters:
arg1
- the function's first argumentarg2
- the function's second argumentarg3
- the function's third argument- 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.
-
deriv2
Get a function computing $\frac{\partial f}{\partial x_2}$.- Returns:
- a function that computes $\frac{\partial f}{\partial x_2}$ where f is this real-valued function
-
deriv2At
public double deriv2At(double arg1, double arg2, double arg3) throws IllegalArgumentException, UnsupportedOperationException, IllegalStateException Evaluate the partial derivative $\frac{\partial f}{\partial x_2}$ for a function f(x2x2).- Parameters:
arg1
- the function's first argumentarg2
- the function's second argumentarg3
- the function's third argument- 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.
-
deriv3
Get a function computing $\frac{\partial f}{\partial x_3}$.- Returns:
- a function that computes $\frac{\partial f}{\partial x_3}$ where f is this real-valued function
-
deriv3At
public double deriv3At(double arg1, double arg2, double arg3) throws IllegalArgumentException, UnsupportedOperationException Evaluate the partial derivative $\frac{\partial f}{\partial x_3}$ for the function f(x1,x2,x3).- Parameters:
arg1
- the function's first argumentarg2
- the function's second argumentarg3
- the function's third argument- 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.
-
secondDeriv
Get a function that computes the value of partial derivative that would be computed by callingsecondDerivAt(int,int,double...)
.- Parameters:
i
- the argument index for the first derivativej
- the argument index for the second derivative- Returns:
- the function
-
secondDerivAt
public final double secondDerivAt(int i, int j, double... args) throws IllegalArgumentException, UnsupportedOperationException, IllegalStateException Evaluate the partial derivative $\frac{\partial^2 f}{\partial x_i \partial z_j}$ for a function f(x0,x1, ...).This method calls a method named deriv
<
i+1><
j+1>
At(...) where i and j are the values of the first two arguments. One should usually override those methods instead of this one.- 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.
-
deriv11
Get a function that computes $\frac{\partial^2 f}{\partial x_1^2}$ where f is this function.- Returns:
- a function that computes $\frac{\partial^2 f}{\partial x_1^2}$
-
deriv11At
public double deriv11At(double arg1, double arg2, double arg3) throws IllegalArgumentException, UnsupportedOperationException, IllegalStateException Evaluate the partial derivative $\frac{\partial^2 f}{\partial x_1^2}$ for a function f(x1x2).- Parameters:
arg1
- the function's first argumentarg2
- the function's second argumentarg3
- the function's third argument- 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.
-
deriv12
Get a function that computes $\frac{\partial^2 f}{\partial x_1 \partial x_2}$ where f is this function.- Returns:
- a function that computes $\frac{\partial^2 f}{\partial x_1 \partial x_2}$ where f is this function. ∂2f / (∂x1 ∂x2)
-
deriv12At
public double deriv12At(double arg1, double arg2, double arg3) throws IllegalArgumentException, UnsupportedOperationException, IllegalStateException Evaluate the partial derivative $\frac{\partial^2 f}{\partial x_1 \partial x_2}$ where f is this function. * ∂2f / (∂x1 ∂x2) for a function f(x1x2).- Parameters:
arg1
- the function's first argumentarg2
- the function's second argumentarg3
- the function's third argument- 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.
-
deriv13
Get a function that computes $\frac{\partial^2 f}{\partial x_1 \partial x_3}$ where f is this function.- Returns:
- a function that computes $\frac{\partial^2 f}{\partial x_1 \partial x_3}$
-
deriv13At
public double deriv13At(double arg1, double arg2, double arg3) throws IllegalArgumentException, UnsupportedOperationException, IllegalStateException Evaluate the partial derivative $\frac{\partial^2 f}{\partial x_1 \partial x_3}$ for a function f(x1x2).- Parameters:
arg1
- the function's first argumentarg2
- the function's second argumentarg3
- the function's third argument- 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.
-
deriv21
Get a function that computes $\frac{\partial^2 f}{\partial x_2 \partial x_1}$ where f is this function.- Returns:
- a function that computes $\frac{\partial^2 f}{\partial x_2 \partial x_1}$
-
deriv21At
public double deriv21At(double arg1, double arg2, double arg3) throws IllegalArgumentException, UnsupportedOperationException, IllegalStateException Evaluate the partial derivative $\frac{\partial^2 f}{\partial x_2 \partial x_1}$ for a function f(x1x2).- Parameters:
arg1
- the function's first argumentarg2
- the function's second argumentarg3
- the function's third argument- 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.
-
deriv22
Get a function that computes $\frac{\partial^2 f}{\partial x_2^2}$ where f is this function.- Returns:
- a function that computes ∂2f / ∂x22
-
deriv22At
public double deriv22At(double arg1, double arg2, double arg3) throws IllegalArgumentException, UnsupportedOperationException, IllegalStateException Evaluate the partial derivative $\frac{\partial^2 f}{\partial x_2^2}$ for a function f(x1x2).- Parameters:
arg1
- the function's first argumentarg2
- the function's second argumentarg3
- the function's third argument- 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.
-
deriv23
Get a function that computes $\frac{\partial^2 f}{\partial x_2 \partial x_3}$ where f is this function.- Returns:
- a function that computes ∂2f / ∂x23
-
deriv23At
public double deriv23At(double arg1, double arg2, double arg3) throws IllegalArgumentException, UnsupportedOperationException, IllegalStateException Evaluate the partial derivative $\frac{\partial^2 f}{\partial x_2 \partial x_3}$ for a function f(x1x2).- Parameters:
arg1
- the function's first argumentarg2
- the function's second argumentarg3
- the function's third argument- 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.
-
deriv31
Get a function that computes $\frac{\partial^2 f}{\partial x_3 \partial x_1}$ where f is this function.- Returns:
- a function that computes ∂2f / ∂x31
-
deriv31At
public double deriv31At(double arg1, double arg2, double arg3) throws IllegalArgumentException, UnsupportedOperationException, IllegalStateException Evaluate the partial derivative $\frac{\partial^2 f}{\partial x_3 \partial x_1}$ for a function f(x1x2).- Parameters:
arg1
- the function's first argumentarg2
- the function's second argumentarg3
- the function's third argument- 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.
-
deriv32
Get a function that computes $\frac{\partial^2 f}{\partial x_3 \partial x_2}$ where f is this function.- Returns:
- a function that computes $\frac{\partial^2 f}{\partial x_3 \partial x_2}$
-
deriv32At
public double deriv32At(double arg1, double arg2, double arg3) throws IllegalArgumentException, UnsupportedOperationException, IllegalStateException Evaluate the partial derivative $\frac{\partial^2 f}{\partial x_3 \partial x_2}$ for a function f(x1x2).- Parameters:
arg1
- the function's first argumentarg2
- the function's second argumentarg3
- the function's third argument- 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.
-
deriv33
Get a function that computes $\frac{\partial^2 f}{\partial x_3^2}$ where f is this function.- Returns:
- a function that computes $\frac{\partial^2 f}{\partial x_3^2}$
-
deriv33At
public double deriv33At(double arg1, double arg2, double arg3) throws IllegalArgumentException, UnsupportedOperationException, IllegalStateException Evaluate the partial derivative $\frac{\partial^2 f}{\partial x_3^2}$ for a function f(x1x2).- Parameters:
arg1
- the function's first argumentarg2
- the function's second argumentarg3
- the function's third argument- 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.
-