Top Description Inners Fields Constructors Methods
org.apache.commons.math3.analysis.function

public Class Logistic

extends Object
implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction
Class Inheritance
All Implemented Interfaces
org.apache.commons.math3.analysis.DifferentiableUnivariateFunction, org.apache.commons.math3.analysis.UnivariateFunction, org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction
Imports
org.apache.commons.math3.analysis.FunctionUtils, .UnivariateFunction, .DifferentiableUnivariateFunction, .ParametricUnivariateFunction, org.apache.commons.math3.analysis.differentiation.DerivativeStructure, .UnivariateDifferentiableFunction, org.apache.commons.math3.exception.NotStrictlyPositiveException, .NullArgumentException, .DimensionMismatchException, org.apache.commons.math3.util.FastMath

Deprecated

as a consequence of DifferentiableUnivariateFunction being deprecated. See corresponding docs for further information.

Generalised logistic function.
Since
3.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
Logistic.Parametric

Parametric function where the input array contains the parameters of the logistic function, ordered as follows:

  • k
  • m
  • b
  • q
  • a
  • n

Field Summary

Modifier and TypeField and Description
private final double
a

Lower asymptote.

private final double
b

Growth rate.

private final double
k

Upper asymptote.

private final double
m

Abscissa of maximum growth.

private final double
oneOverN

Parameter that affects near which asymptote maximum growth occurs.

private final double
q

Parameter that affects the position of the curve along the ordinate axis.

Constructor Summary

AccessConstructor and Description
public
Logistic(double
If b > 0, value of the function for x going towards +∞. If b < 0, value of the function for x going towards -∞.
k
,
double
Abscissa of maximum growth.
m
,
double
Growth rate.
b
,
double
Parameter that affects the position of the curve along the ordinate axis.
q
,
double
If b > 0, value of the function for x going towards -∞. If b < 0, value of the function for x going towards +∞.
a
,
double
Parameter that affects near which asymptote the maximum growth occurs.
n
)

Method Summary

Modifier and TypeMethod and Description
public UnivariateFunction
derivative()

Implements org.apache.commons.math3.analysis.DifferentiableUnivariateFunction.derivative.

Deprecated as of 3.1, replaced by value(DerivativeStructure)

Returns the derivative of the function

public double
value(double
Point at which the function value should be computed.
x
)

Implements org.apache.commons.math3.analysis.UnivariateFunction.value.

Compute the value of the function.

private static double

Returns:

the value of the function.
value
(double
m - x.
mMinusX
,
double
k.
k
,
double
b.
b
,
double
q.
q
,
double
a.
a
,
double
1 / n.
oneOverN
)

public DerivativeStructure
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

aback to summary
private final double a

Lower asymptote.

bback to summary
private final double b

Growth rate.

kback to summary
private final double k

Upper asymptote.

mback to summary
private final double m

Abscissa of maximum growth.

oneOverNback to summary
private final double oneOverN

Parameter that affects near which asymptote maximum growth occurs.

qback to summary
private final double q

Parameter that affects the position of the curve along the ordinate axis.

Constructor Detail

Logisticback to summary
public Logistic(double k, double m, double b, double q, double a, double n) throws NotStrictlyPositiveException
Parameters
k:double

If b > 0, value of the function for x going towards +∞. If b < 0, value of the function for x going towards -∞.

m:double

Abscissa of maximum growth.

b:double

Growth rate.

q:double

Parameter that affects the position of the curve along the ordinate axis.

a:double

If b > 0, value of the function for x going towards -∞. If b < 0, value of the function for x going towards +∞.

n:double

Parameter that affects near which asymptote the maximum growth occurs.

Exceptions
NotStrictlyPositiveException:
if n <= 0.

Method Detail

derivativeback to summary
public UnivariateFunction derivative()

Implements org.apache.commons.math3.analysis.DifferentiableUnivariateFunction.derivative.

Doc from org.apache.commons.math3.analysis.DifferentiableUnivariateFunction.derivative.

Deprecated

as of 3.1, replaced by value(DerivativeStructure)

Returns the derivative of the function

Returns:UnivariateFunction

the derivative function

Annotations
@Deprecated
valueback to summary
public double value(double x)

Implements org.apache.commons.math3.analysis.UnivariateFunction.value.

Doc from org.apache.commons.math3.analysis.UnivariateFunction.value.

Compute the value of the function.

Parameters
x:double

Point at which the function value should be computed.

Returns:double

the value of the function.

valueback to summary
private static double value(double mMinusX, double k, double b, double q, double a, double oneOverN)
Parameters
mMinusX:double

m - x.

k:double

k.

b:double

b.

q:double

q.

a:double

a.

oneOverN:double

1 / n.

Returns:double

the value of the function.

valueback to summary
public DerivativeStructure value(final DerivativeStructure t)

Implements org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction.value.

Doc from org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction.value.

Simple mathematical function.

UnivariateDifferentiableFunction classes compute both the value and the first derivative of the function.

Parameters
t:DerivativeStructure

function input value

Returns:DerivativeStructure

function result

Since
3.1
org.apache.commons.math3.analysis.function back to summary

public Class Logistic.Parametric

extends Object
implements ParametricUnivariateFunction
Class Inheritance
  • java.lang.Object
  • org.apache.commons.math3.analysis.function.Logistic.Parametric
All Implemented Interfaces
org.apache.commons.math3.analysis.ParametricUnivariateFunction

Parametric function where the input array contains the parameters of the logistic function, ordered as follows:

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public double[]

Returns:

the gradient vector at x.
gradient
(double
Value at which the gradient must be computed.
x
,
double...
Values for k, m, b, q, a and n.
param
)

Implements org.apache.commons.math3.analysis.ParametricUnivariateFunction.gradient.

Computes the value of the gradient at x.

private void
validateParameters(double[]
Values for k, m, b, q, a and n.
param
)

Validates parameters to ensure they are appropriate for the evaluation of the value(double, double[]) and gradient(double, double[]) methods.

public double

Returns:

the value of the function.
value
(double
Value for which the function must be computed.
x
,
double...
Values for k, m, b, q, a and n.
param
)

Implements org.apache.commons.math3.analysis.ParametricUnivariateFunction.value.

Computes the value of the sigmoid at x.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Parametricback to summary
public Parametric()

Method Detail

gradientback to summary
public double[] gradient(double x, double... param) throws NullArgumentException, DimensionMismatchException, NotStrictlyPositiveException

Implements org.apache.commons.math3.analysis.ParametricUnivariateFunction.gradient.

Computes the value of the gradient at x. The components of the gradient vector are the partial derivatives of the function with respect to each of the parameters.

Parameters
x:double

Value at which the gradient must be computed.

param:double[]

Values for k, m, b, q, a and n.

Returns:double[]

the gradient vector at x.

Exceptions
NullArgumentException:
if param is null.
DimensionMismatchException:
if the size of param is not 6.
NotStrictlyPositiveException:
if param[5] <= 0.
validateParametersback to summary
private void validateParameters(double[] param) throws NullArgumentException, DimensionMismatchException, NotStrictlyPositiveException

Validates parameters to ensure they are appropriate for the evaluation of the value(double, double[]) and gradient(double, double[]) methods.

Parameters
param:double[]

Values for k, m, b, q, a and n.

Exceptions
NullArgumentException:
if param is null.
DimensionMismatchException:
if the size of param is not 6.
NotStrictlyPositiveException:
if param[5] <= 0.
valueback to summary
public double value(double x, double... param) throws NullArgumentException, DimensionMismatchException, NotStrictlyPositiveException

Implements org.apache.commons.math3.analysis.ParametricUnivariateFunction.value.

Computes the value of the sigmoid at x.

Parameters
x:double

Value for which the function must be computed.

param:double[]

Values for k, m, b, q, a and n.

Returns:double

the value of the function.

Exceptions
NullArgumentException:
if param is null.
DimensionMismatchException:
if the size of param is not 6.
NotStrictlyPositiveException:
if param[5] <= 0.