hesseflux.functions.logistic_function¶
Module with several forms of the logistic function and its first and second derivatives.
- The current functions are:
logistic Logistic function L/(1+exp(-k(x-x0)))
logistic_p logistic(x,*p)
dlogistic First derivative of logistic function
dlogistic_p dlogistic(x,*p)
d2logistic Second derivative of logistic function
d2logistic_p d2logistic(x,*p)
logistic_offset logistic function with offset L/(1+exp(-k(x-x0))) + a
logistic_offset_p logistic_offset(x,*p)
dlogistic_offset First derivative of logistic function with offset
dlogistic_offset_p dlogistic_offset(x,*p)
d2logistic_offset Second derivative of logistic function with offset
d2logistic_offset_p d2logistic_offset(x,*p)
logistic2_offset Double logistic function with offset L1/(1+exp(-k1(x-x01))) - L2/(1+exp(-k2(x-x02))) + a
logistic2_offset_p logistic2_offset(x,*p)
dlogistic2_offset First derivative of double logistic function with offset
dlogistic2_offset_p dlogistic2_offset(x,*p)
d2logistic2_offset Second derivative of double logistic function with offset
d2logistic2_offset_p d2logistic2_offset(x,*p)
This module was written by Matthias Cuntz while at Department of Computational Hydrosystems, Helmholtz Centre for Environmental Research - UFZ, Leipzig, Germany, and continued while at Institut National de Recherche pour l’Agriculture, l’Alimentation et l’Environnement (INRAE), Nancy, France.
Copyright (c) 2015-2020 Matthias Cuntz - mc (at) macu (dot) de Released under the MIT License; see LICENSE file for details.
- Written Mar 2015 by Matthias Cuntz (mc (at) macu (dot) de)
- Added functions logistic_p and logistic_offset_p, Dec 2017, Matthias Cuntz
- Changed to Sphinx docstring and numpydoc, Dec 2019, Matthias Cuntz
- Distinguish iterable and array_like parameter types, Jan 2020, Matthias Cuntz
- Make systematically function_p versions of all logistic functions and its derivatives, Feb 2020, Matthias Cuntz
- Split logistic and curvature into separate files, May 2020, Matthias Cuntz
The following functions are provided:
logistic (x, L, k, x0) |
Logistic function: |
logistic_p (x, p) |
Wrapper function for logistic() : logistic(x, *p). |
dlogistic (x, L, k, x0) |
First derivative of logistic function: |
dlogistic_p (x, p) |
Wrapper function for dlogistic() : dlogistic(x, *p). |
d2logistic (x, L, k, x0) |
Second derivative of logistic function: |
d2logistic_p (x, p) |
Wrapper function for d2logistic() : d2logistic(x, *p). |
logistic_offset (x, L, k, x0, a) |
Logistic function with offset: |
logistic_offset_p (x, p) |
Wrapper function for logistic_offset() : logistic_offset(x, *p). |
dlogistic_offset (x, L, k, x0, a) |
First derivative of logistic function with offset: |
dlogistic_offset_p (x, p) |
Wrapper function for dlogistic_offset() : dlogistic_offset(x, *p). |
d2logistic_offset (x, L, k, x0, a) |
Second derivative of logistic function with offset |
d2logistic_offset_p (x, p) |
Wrapper function for d2logistic_offset() : d2logistic_offset(x, *p). |
logistic2_offset (x, L1, k1, x01, L2, k2, x02, a) |
Double logistic function with offset: |
logistic2_offset_p (x, p) |
Wrapper function for logistic2_offset() : logistic2_offset(x, *p). |
dlogistic2_offset (x, L1, k1, x01, L2, k2, x02, a) |
First derivative of double logistic function with offset: |
dlogistic2_offset_p (x, p) |
Wrapper function for dlogistic2_offset() : dlogistic2_offset(x, *p). |
d2logistic2_offset (x, L1, k1, x01, L2, k2, …) |
Second derivative of double logistic function with offset: |
d2logistic2_offset_p (x, p) |
Wrapper function for d2logistic2_offset() : d2logistic2_offset(x, *p). |
-
logistic
(x, L, k, x0)[source]¶ Logistic function:
L/(1+exp(-k(x-x0)))Parameters: Returns: Logistic function at x with maximum L, steepness k and inflection point x0
Return type: float or ndarray
-
logistic_p
(x, p)[source]¶ Wrapper function for
logistic()
: logistic(x, *p).
-
dlogistic
(x, L, k, x0)[source]¶ First derivative of logistic function:
L/(1+exp(-k(x-x0)))which is
k.L/(2(cosh(k(x-x0))+1))Parameters: Returns: First derivative of logistic function at x with maximum L, steepness k and inflection point x0
Return type: float or ndarray
-
dlogistic_p
(x, p)[source]¶ Wrapper function for
dlogistic()
: dlogistic(x, *p).
-
d2logistic
(x, L, k, x0)[source]¶ Second derivative of logistic function:
L/(1+exp(-k(x-x0)))which is
-k^2.L.sinh(k(x-x0))/(2(cosh(k(x-x0))+1)^2)Parameters: Returns: Second derivative of logistic function at x with maximum L, steepness k and inflection point x0
Return type: float or ndarray
-
d2logistic_p
(x, p)[source]¶ Wrapper function for
d2logistic()
: d2logistic(x, *p).
-
logistic_offset
(x, L, k, x0, a)[source]¶ Logistic function with offset:
L/(1+exp(-k(x-x0))) + aParameters: Returns: Logistic function at x with maximum L, steepness k, inflection point x0 and offset a
Return type: float or ndarray
-
logistic_offset_p
(x, p)[source]¶ Wrapper function for
logistic_offset()
: logistic_offset(x, *p).
-
dlogistic_offset
(x, L, k, x0, a)[source]¶ First derivative of logistic function with offset:
L/(1+exp(-k(x-x0))) + awhich is
k.L/(2(cosh(k(x-x0))+1))Parameters: Returns: First derivative of logistic function with offset at x with maximum L, steepness k, inflection point x0, and offset a
Return type: float or ndarray
-
dlogistic_offset_p
(x, p)[source]¶ Wrapper function for
dlogistic_offset()
: dlogistic_offset(x, *p).
-
d2logistic_offset
(x, L, k, x0, a)[source]¶ Second derivative of logistic function with offset
L/(1+exp(-k(x-x0))) + awhich is
-k^2.L.sinh(k(x-x0))/(2(cosh(k(x-x0))+1)^2)Parameters: Returns: Second derivative of logistic function at x with maximum L, steepness k, inflection point x0, and offset a
Return type: float or ndarray
-
d2logistic_offset_p
(x, p)[source]¶ Wrapper function for
d2logistic_offset()
: d2logistic_offset(x, *p).
-
logistic2_offset
(x, L1, k1, x01, L2, k2, x02, a)[source]¶ Double logistic function with offset:
L1/(1+exp(-k1(x-x01))) - L2/(1+exp(-k2(x-x02))) + aParameters: - x (array_like) – Independent variable to evalute logistic function
- L1 (float) – Maximum of first logistic function
- k1 (float) – Steepness of first logistic function
- x01 (float) – Inflection point of first logistic function
- L2 (float) – Maximum of second logistic function
- k2 (float) – Steepness of second logistic function
- x02 (float) – Inflection point of second logistic function
- a (float) – Offset of double logistic function
Returns: Double Logistic function at x
Return type: float or ndarray
-
logistic2_offset_p
(x, p)[source]¶ Wrapper function for
logistic2_offset()
: logistic2_offset(x, *p).
-
dlogistic2_offset
(x, L1, k1, x01, L2, k2, x02, a)[source]¶ First derivative of double logistic function with offset:
L1/(1+exp(-k1(x-x01))) - L2/(1+exp(-k2(x-x02))) + awhich is
k1.L1/(2(cosh(k1(x-x01))+1)) - k2.L2/(2(cosh(k2(x-x02))+1))Parameters: - x (array_like) – Independent variable to evalute logistic function
- L1 (float) – Maximum of first logistic function
- k1 (float) – Steepness of first logistic function
- x01 (float) – Inflection point of first logistic function
- L2 (float) – Maximum of second logistic function
- k2 (float) – Steepness of second logistic function
- x02 (float) – Inflection point of second logistic function
- a (float) – Offset of double logistic function
Returns: First derivative of double logistic function with offset at x
Return type: float or ndarray
-
dlogistic2_offset_p
(x, p)[source]¶ Wrapper function for
dlogistic2_offset()
: dlogistic2_offset(x, *p).
-
d2logistic2_offset
(x, L1, k1, x01, L2, k2, x02, a)[source]¶ Second derivative of double logistic function with offset:
L1/(1+exp(-k1(x-x01))) - L2/(1+exp(-k2(x-x02))) + awhich is
-k1^2.L1.sinh(k1(x-x01))/(2(cosh(k1(x-x01))+1)^2) +k2^2.L2.sinh(k2(x-x02))/(2(cosh(k2(x-x02))+1)^2)Parameters: - x (array_like) – Independent variable to evalute logistic function
- L1 (float) – Maximum of first logistic function
- k1 (float) – Steepness of first logistic function
- x01 (float) – Inflection point of first logistic function
- L2 (float) – Maximum of second logistic function
- k2 (float) – Steepness of second logistic function
- x02 (float) – Inflection point of second logistic function
- a (float) – Offset of double logistic function
Returns: Second derivative of double logistic function with offset at x
Return type: float or ndarray
-
d2logistic2_offset_p
(x, p)[source]¶ Wrapper function for
d2logistic2_offset()
: d2logistic2_offset(x, *p).