集册 Java实例教程 对数均值

对数均值

欢马劈雪     最近更新时间:2020-01-02 10:19:05

621
提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
对数均值
// from n o w j a   v  a . c o m - 时  代  Java

public class Main {

  static double LogarithmicMean(double[] array, int i, int j) {

    if (j - i == 0)

      return array[i];

    else {

      int n = j - i + 1;

      return (n - 1) * (LogarithmicMean(array, i + 1, j) - LogarithmicMean(array, i, j - 1))

          / (Math.log(array[j]) - Math.log(array[i]));

    }

  }


  static double LogarithmicMean(double[] array) {

    return LogarithmicMean(array, 0, array.length - 1);

  }

  

  public static void main(String[] argv) {

    double[] d = 
展开阅读全文