You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by oe...@apache.org on 2015/11/10 21:32:13 UTC
[2/2] [math] MATH-1285: added definition of distribution to javadoc
of ZipfDistribution
MATH-1285: added definition of distribution to javadoc of
ZipfDistribution
Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/29dfd9bb
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/29dfd9bb
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/29dfd9bb
Branch: refs/heads/MATH_3_X
Commit: 29dfd9bb660cbcfb76aabc80458f9452c991bd35
Parents: 430c7f4
Author: Otmar Ertl <ot...@gmail.com>
Authored: Tue Nov 10 21:22:42 2015 +0100
Committer: Otmar Ertl <ot...@gmail.com>
Committed: Tue Nov 10 21:22:42 2015 +0100
----------------------------------------------------------------------
.../math3/distribution/ZipfDistribution.java | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-math/blob/29dfd9bb/src/main/java/org/apache/commons/math3/distribution/ZipfDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/distribution/ZipfDistribution.java b/src/main/java/org/apache/commons/math3/distribution/ZipfDistribution.java
index 4538a3a..224aad4 100644
--- a/src/main/java/org/apache/commons/math3/distribution/ZipfDistribution.java
+++ b/src/main/java/org/apache/commons/math3/distribution/ZipfDistribution.java
@@ -25,8 +25,22 @@ import org.apache.commons.math3.util.FastMath;
/**
* Implementation of the Zipf distribution.
- *
+ * <p>
+ * <strong>Parameters:</strong>
+ * For a random variable {@code X} whose values are distributed according to this
+ * distribution, the probability mass function is given by
+ * <pre>
+ * P(X = k) = H(N,s) * 1 / k^s for {@code k = 1,2,...,N}.
+ * </pre>
+ * {@code H(N,s)} is the normalizing constant
+ * which corresponds to the generalized harmonic number of order N of s.
+ * <p>
+ * <ul>
+ * <li>{@code N} is the number of elements</li>
+ * <li>{@code s} is the exponent</li>
+ * </ul>
* @see <a href="https://en.wikipedia.org/wiki/Zipf's_law">Zipf's law (Wikipedia)</a>
+ * @see <a href="https://en.wikipedia.org/wiki/Harmonic_number#Generalized_harmonic_numbers">Generalized harmonic numbers</a>
*/
public class ZipfDistribution extends AbstractIntegerDistribution {
/** Serializable version identifier. */
Re: [2/2] [math] MATH-1285: added definition of distribution to
javadoc of ZipfDistribution
Posted by Otmar Ertl <ot...@gmail.com>.
Thanks, good to know. Unfortunately, I used LogNormalDistribution as template.
On Tue, Nov 10, 2015 at 9:51 PM, Gilles <gi...@harfang.homelinux.org> wrote:
> Hi Otmar.
>
> On Tue, 10 Nov 2015 20:32:13 -0000, oertl@apache.org wrote:
>>
>> MATH-1285: added definition of distribution to javadoc of
>> ZipfDistribution
>>
>> [...]
>>
>> diff --git
>>
>>
>> a/src/main/java/org/apache/commons/math3/distribution/ZipfDistribution.java
>>
>>
>> b/src/main/java/org/apache/commons/math3/distribution/ZipfDistribution.java
>> index 4538a3a..224aad4 100644
>> ---
>>
>>
>> a/src/main/java/org/apache/commons/math3/distribution/ZipfDistribution.java
>> +++
>>
>>
>> b/src/main/java/org/apache/commons/math3/distribution/ZipfDistribution.java
>> @@ -25,8 +25,22 @@ import org.apache.commons.math3.util.FastMath;
>>
>> /**
>> * Implementation of the Zipf distribution.
>> - *
>> + * <p>
>> + * <strong>Parameters:</strong>
>> + * For a random variable {@code X} whose values are distributed
>> according to this
>> + * distribution, the probability mass function is given by
>> + * <pre>
>> + * P(X = k) = H(N,s) * 1 / k^s for {@code k = 1,2,...,N}.
>> + * </pre>
>> + * {@code H(N,s)} is the normalizing constant
>> + * which corresponds to the generalized harmonic number of order N of s.
>> + * <p>
>> + * <ul>
>> + * <li>{@code N} is the number of elements</li>
>> + * <li>{@code s} is the exponent</li>
>> + * </ul>
>
>
> Some time ago, we decided to use MathJax for writing all math formulae
> in Javadoc. [I.e. it is LaTeX code enclosed in "\(" and "\)" markers.
> See e.g. the doc in file "stat/inference/KolmogorovSmirnovTest.java".]
>
> Note sure whether it was written down somewhere (apart from the ML archive).
>
>
> Best regards,
> Gilles
>
>> [...]
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: [2/2] [math] MATH-1285: added definition of distribution to
javadoc of ZipfDistribution
Posted by Gilles <gi...@harfang.homelinux.org>.
Hi Otmar.
On Tue, 10 Nov 2015 20:32:13 -0000, oertl@apache.org wrote:
> MATH-1285: added definition of distribution to javadoc of
> ZipfDistribution
>
> [...]
>
> diff --git
>
> a/src/main/java/org/apache/commons/math3/distribution/ZipfDistribution.java
>
> b/src/main/java/org/apache/commons/math3/distribution/ZipfDistribution.java
> index 4538a3a..224aad4 100644
> ---
>
> a/src/main/java/org/apache/commons/math3/distribution/ZipfDistribution.java
> +++
>
> b/src/main/java/org/apache/commons/math3/distribution/ZipfDistribution.java
> @@ -25,8 +25,22 @@ import org.apache.commons.math3.util.FastMath;
>
> /**
> * Implementation of the Zipf distribution.
> - *
> + * <p>
> + * <strong>Parameters:</strong>
> + * For a random variable {@code X} whose values are distributed
> according to this
> + * distribution, the probability mass function is given by
> + * <pre>
> + * P(X = k) = H(N,s) * 1 / k^s for {@code k = 1,2,...,N}.
> + * </pre>
> + * {@code H(N,s)} is the normalizing constant
> + * which corresponds to the generalized harmonic number of order N
> of s.
> + * <p>
> + * <ul>
> + * <li>{@code N} is the number of elements</li>
> + * <li>{@code s} is the exponent</li>
> + * </ul>
Some time ago, we decided to use MathJax for writing all math formulae
in Javadoc. [I.e. it is LaTeX code enclosed in "\(" and "\)" markers.
See e.g. the doc in file "stat/inference/KolmogorovSmirnovTest.java".]
Note sure whether it was written down somewhere (apart from the ML
archive).
Best regards,
Gilles
> [...]
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org