Luc Maisonobe wrote: > 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.
Fixed in r925826. Thanks! Phil > Luc > >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
