Return-Path: Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: (qmail 14928 invoked from network); 26 Dec 2010 19:52:07 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 26 Dec 2010 19:52:07 -0000 Received: (qmail 21700 invoked by uid 500); 26 Dec 2010 19:52:07 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 21618 invoked by uid 500); 26 Dec 2010 19:52:07 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 21610 invoked by uid 99); 26 Dec 2010 19:52:07 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 26 Dec 2010 19:52:07 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 26 Dec 2010 19:52:06 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id oBQJpkIi023132 for ; Sun, 26 Dec 2010 19:51:46 GMT Message-ID: <13740579.23141293393106669.JavaMail.jira@thor> Date: Sun, 26 Dec 2010 14:51:46 -0500 (EST) From: "Mikkel Meyer Andersen (JIRA)" To: issues@commons.apache.org Subject: [jira] Issue Comment Edited: (MATH-385) Characteristic (support, mean, variance, ...) on Distributions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/MATH-385?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12975150#action_12975150 ] Mikkel Meyer Andersen edited comment on MATH-385 at 12/26/10 2:51 PM: ---------------------------------------------------------------------- I could convert pow(x, 2) to x*x, but the what about the following, then: {noformat} ...$ grep -iHR "pow(.*, 2)" . ./WeibullDistributionImpl.java: return FastMath.pow(scale, 2) * ./WeibullDistributionImpl.java: FastMath.pow(mean, 2); ./ExponentialDistributionImpl.java: return FastMath.pow(getMean(), 2); ./NormalDistributionImpl.java: return FastMath.pow(getStandardDeviation(), 2); ./GammaDistributionImpl.java: return getAlpha() * FastMath.pow(getBeta(), 2); ./ZipfDistributionImpl.java: return (Hs2 / Hs) - (FastMath.pow(Hs1, 2) / FastMath.pow(Hs, 2)); ./FDistributionImpl.java: return ( 2 * FastMath.pow(denominatorDF, 2) * (numeratorDF + denominatorDF - 2) ) ./FDistributionImpl.java: / ( (numeratorDF * Math.pow(denominatorDF - 2, 2) * (denominatorDF - 4)) ); ./BetaDistributionImpl.java: return (alpha * beta) / (FastMath.pow(alphabetasum, 2) * (alphabetasum + 1)); {noformat} was (Author: mikl): I could convert pow(x, 2) to x*x, but the what about the following, then: {{...$ grep -iHR "pow(.*, 2)" . ./WeibullDistributionImpl.java: return FastMath.pow(scale, 2) * ./WeibullDistributionImpl.java: FastMath.pow(mean, 2); ./ExponentialDistributionImpl.java: return FastMath.pow(getMean(), 2); ./NormalDistributionImpl.java: return FastMath.pow(getStandardDeviation(), 2); ./GammaDistributionImpl.java: return getAlpha() * FastMath.pow(getBeta(), 2); ./ZipfDistributionImpl.java: return (Hs2 / Hs) - (FastMath.pow(Hs1, 2) / FastMath.pow(Hs, 2)); ./FDistributionImpl.java: return ( 2 * FastMath.pow(denominatorDF, 2) * (numeratorDF + denominatorDF - 2) ) ./FDistributionImpl.java: / ( (numeratorDF * Math.pow(denominatorDF - 2, 2) * (denominatorDF - 4)) ); ./BetaDistributionImpl.java: return (alpha * beta) / (FastMath.pow(alphabetasum, 2) * (alphabetasum + 1));}} > Characteristic (support, mean, variance, ...) on Distributions > -------------------------------------------------------------- > > Key: MATH-385 > URL: https://issues.apache.org/jira/browse/MATH-385 > Project: Commons Math > Issue Type: New Feature > Reporter: Mikkel Meyer Andersen > Assignee: Mikkel Meyer Andersen > Fix For: 2.2 > > Attachments: MATH385-PATCH1, MATH385-PATCH2 > > Original Estimate: 5h > Remaining Estimate: 5h > > I wish that the Distributions could contain some characteristics. For example support, mean, and variance. > Support: > AbstractContinuousDistribution and AbstractIntegerDistribution should have double getSupport{Lower, Upper}Bound() and int getSupport{Lower, Upper}Bound(), respectively. Also methods a la boolean isSupport{Lower, Upper}BoundInclusive() on AbstractContinuousDistribution should reflect if the support is open of closed. In practise the implemented distributions are easy since the support for all continuous distributions are real intervals (connected sets), and the support for all the discrete distributions are connected integer sets. This means that the lower and upper bound (together with isSupport{Lower, Upper}BoundInclusive() on AbstractContinuousDistribution because it is not needed on the discrete distributions because of their nature) are sufficient for determine the support. > Mean and variance: > double get{Mean, Variance}() should be on AbstractDistribution. > With such characteristic an invalidateParameters-method might come in handy because they often depend on the parameters. The characteristics should not be calculated before the first time they are get'ted, and when calculated, they should be saved for later use. When parameters change, an invalidateParameters-method should be called to force the characteristics to be recalculated. > Values such as Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY, and Double.NaN should be used where appropriate. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.