Return-Path: Delivered-To: apmail-commons-user-archive@www.apache.org Received: (qmail 6310 invoked from network); 20 Mar 2010 23:01:34 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 20 Mar 2010 23:01:34 -0000 Received: (qmail 21003 invoked by uid 500); 20 Mar 2010 23:01:33 -0000 Delivered-To: apmail-commons-user-archive@commons.apache.org Received: (qmail 20895 invoked by uid 500); 20 Mar 2010 23:01:33 -0000 Mailing-List: contact user-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Users List" Delivered-To: mailing list user@commons.apache.org Received: (qmail 20887 invoked by uid 99); 20 Mar 2010 23:01:33 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 20 Mar 2010 23:01:33 +0000 X-ASF-Spam-Status: No, hits=0.7 required=10.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [194.206.126.239] (HELO smtp.nordnet.fr) (194.206.126.239) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 20 Mar 2010 23:01:23 +0000 Received: from lehrin (203.211.20.81.dynamic.adsl.abo.nordnet.fr [81.20.211.203]) by smtp.nordnet.fr (Postfix) with ESMTP id 4768C34081 for ; Sun, 21 Mar 2010 00:01:01 +0100 (CET) Received: by lehrin (Postfix, from userid 5001) id CFCC540C7; Sun, 21 Mar 2010 00:01:02 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on lehrin.spaceroots.local X-Spam-Level: Received: from lehrin.spaceroots.local (lehrin.spaceroots.local [127.0.0.1]) by lehrin (Postfix) with ESMTP id D0A1240C2 for ; Sun, 21 Mar 2010 00:01:01 +0100 (CET) Message-ID: <4BA553AD.1080200@free.fr> Date: Sun, 21 Mar 2010 00:01:01 +0100 From: Luc Maisonobe User-Agent: Thunderbird 2.0.0.24 (X11/20100317) MIME-Version: 1.0 To: Commons Users List Subject: Re: [math] Can't find newInstance() and getMedian() methods in DescriptiveStatistics References: <308d4701003201450o62edb296lfb043bc11e6ab46b@mail.gmail.com> In-Reply-To: <308d4701003201450o62edb296lfb043bc11e6ab46b@mail.gmail.com> X-Enigmail-Version: 0.95.7 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked by ClamAV on apache.org X-Old-Spam-Status: No, score=-1.4 required=5.0 tests=ALL_TRUSTED autolearn=failed version=3.2.5 Disc Magnet a �crit : > I was trying to run the first example given in this page: > http://commons.apache.org/math/userguide/stat.html My program is as > follows: > > import org.apache.commons.math.stat.descriptive.DescriptiveStatistics; > > public class DescStats > { > public static void main(String[] args) > { > System.out.println("hello, world"); > > DescriptiveStatistics stats = DescriptiveStatistics.newInstance(); > > int inputArray[] = new int[] {5, 7, 1, 3, 8}; > for (int i = 0; i < inputArray.length; i++) { > stats.addValue(inputArray[i]); > } > > double mean = stats.getMean(); > double std = stats.getStandardDeviation(); > double median = stats.getMedian(); > > System.out.println("mean: " + mean); > System.out.println("std: " + std); > System.out.println("median: " + median); > } > } > > I get this error on trying to compile: > > DescStats.java:9: cannot find symbol > symbol : method newInstance() > location: class org.apache.commons.math.stat.descriptive.DescriptiveStatistics > DescriptiveStatistics stats = DescriptiveStatistics.newInstance(); > ^ > DescStats.java:18: cannot find symbol > symbol : method getMedian() > location: class org.apache.commons.math.stat.descriptive.DescriptiveStatistics > double median = stats.getMedian(); > > I checked the apidocs at > http://commons.apache.org/math/apidocs/org/apache/commons/math/stat/descriptive/DescriptiveStatistics.html > and found that newInstance() and getMedian() methods are not present. > Is the tutorial very old and out of sync with the latest Commons Math? This is a documentation bug. Factory features have been deprecated in 1.2 and removed in 2.0, but it seems we forgot to update this example in the stat part, despite this part has been updated several times since then. Could you open a JIRA issue so we don't forget it ? Thanks for reporting this. Luc > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@commons.apache.org > For additional commands, e-mail: user-help@commons.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@commons.apache.org For additional commands, e-mail: user-help@commons.apache.org