how to "Harmonic Mean" manual

This is a discussion on how to "Harmonic Mean" manual within the PHP General forums, part of the PHP Programming Forums category; i know stats_harmonic_mean(), but i am not server admin, i can't install PECL, so i need make it by ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 12-14-2007
LKSunny
 
Posts: n/a
Default how to "Harmonic Mean" manual

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 !!
Reply With Quote
  #2 (permalink)  
Old 12-14-2007
Jochem Maas
 
Posts: n/a
Default Re: [PHP] how to "Harmonic Mean" manual

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.

>

Reply With Quote
  #3 (permalink)  
Old 12-14-2007
LKSunny
 
Posts: n/a
Default Re: [PHP] how to "Harmonic Mean" manual

i know it can make simple function, if have Statistics knowledge...

reference:
http://en.wikipedia.org/wiki/Harmonic_Mean

"Jochem Maas" <jochem@iamjochem.com>
???????:47628FED.3080701@iamjochem.com...
> 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.
>
>>

Reply With Quote
  #4 (permalink)  
Old 12-14-2007
Jochem Maas
 
Posts: n/a
Default Re: [PHP] how to "Harmonic Mean" manual

LKSunny wrote:
> i know it can make simple function, if have Statistics knowledge...


ah so you can read a page and therefore determine it's simple even though
you have no 'Statistics knowledge' - brilliant deduction.

you have 3 choices (given that your to stubborn to ask the sys admin to install
the stats extention):

1. get some 'Statistics knowledge'
2. find a statistics/maths forum/mailinglist
3. pray someone with the patience to grok your question has
such a function lying around and is willing to share.

have !! a !! very !! nice !! day !!

>
> reference:
> http://en.wikipedia.org/wiki/Harmonic_Mean
>
> "Jochem Maas" <jochem@iamjochem.com>
> ???????:47628FED.3080701@iamjochem.com...
>> 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.
>>

>

Reply With Quote
  #5 (permalink)  
Old 12-14-2007
Per Jessen
 
Posts: n/a
Default Re: [PHP] how to "Harmonic Mean" manual

LKSunny wrote:

> i know it can make simple function, if have Statistics knowledge...
>


I don't think you need to know much about statistics - AFAIK, the
harmonic mean of a group of numbers is simply the reciprocal of
the 'normal' mean:

harmonic_mean(3,4,5,6) = 1/mean(3,4,5,6)


/Per Jessen, Zürich
Reply With Quote
  #6 (permalink)  
Old 12-14-2007
Richard Lynch
 
Posts: n/a
Default Re: [PHP] how to "Harmonic Mean" manual

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@iamjochem.com>
> ???????:47628FED.3080701@iamjochem.com...
>> 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?
Reply With Quote
  #7 (permalink)  
Old 12-14-2007
Per Jessen
 
Posts: n/a
Default Re: [PHP] how to "Harmonic Mean" manual

Per Jessen wrote:

> I don't think you need to know much about statistics - AFAIK, the
> harmonic mean of a group of numbers is simply the reciprocal of
> the 'normal' mean:
>
> harmonic_mean(3,4,5,6) = 1/mean(3,4,5,6)


Ignore that.


/Per Jessen, Zürich
Reply With Quote
  #8 (permalink)  
Old 12-15-2007
LKSunny
 
Posts: n/a
Default Re: [PHP] how to "Harmonic Mean" manual

i testing ~ it's correct

Thank You Very Much !!

""Richard Lynch"" <ceo@l-i-e.com>
???????:42955.98.193.37.55.1197651098.squirrel@www .l-i-e.com...
> 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@iamjochem.com>
>> ???????:47628FED.3080701@iamjochem.com...
>>> 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?

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 01:56 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0