Re: how to "Harmonic Mean" manual

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If I am reading Wikipeadia correctly, you want this:

<?php
function stats_harmonic_mean($array){
  $count = count($array);
  $mean = 0;
  foreach($array as $n){
    $mean += 1/$n;
  }
  $mean = $count / $mean;
  return $mean;
}
?>

No guarantees as to correctness.

The *real* function probably takes a variable number of arguments, and
you can do that if you need to, but you're on your own for that.

On Fri, December 14, 2007 8:38 am, LKSunny wrote:
> i know it can make simple function, if have Statistics knowledge...
>
> reference:
> http://en.wikipedia.org/wiki/Harmonic_Mean
>
> "Jochem Maas" <jochem@xxxxxxxxxxxxx>
> ???????:47628FED.3080701@xxxxxxxxxxxxxxxx
>> LKSunny wrote:
>>> i know stats_harmonic_mean(), but i am not server admin, i can't
>>> install
>>> PECL, so i need make it by manual, but i have't Statistics
>>> knowledge, any
>>> one can help me ? thank you very much !!
>>
>> I doubt anyone is going to write a php version of that function for
>> you.
>>
>> given that you are not the server admin then someone else must be,
>> go to
>> that person and ask them to run the relevant pecl command:
>>
>> pecl install stats
>>
>> if they won't get another hoster. regardless you can still develop
>> with
>> that extension
>> on your local machine.
>>
>> If you really need such a function/extension then you should be
>> able to convince the client that it's less effort to find suitable
>> hosting
>> than it
>> is to waste time reinventing a, potentially complex, wheel.
>>
>>>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux