Jump to content

Archived

This topic is now archived and is closed to further replies.

brown2005

root-mean-square

Recommended Posts

hi,

does anyone know how to write php code for a root mean square, i was brosing on the net and saw it and wanted to know how it was done.

Share this post


Link to post
Share on other sites
[quote author=brown2005 link=topic=102059.msg404505#msg404505 date=1154002874]
hi,

does anyone know how to write php code for a root mean square, i was brosing on the net and saw it and wanted to know how it was done.
[/quote]I don't fully understand, do you want to know how to calculate the RMS of an array of values?

Share this post


Link to post
Share on other sites
well i saw on a rating thing, they use a root mean square to combat someone who just keeps putting 1111111111111111111111111111111 for everone...

so i wanted to know how they do it

Share this post


Link to post
Share on other sites
I don't understand how this will help, RMS "is a statistical measure of the magnitude of a varying quantity". I'm not brilliant in maths, but I think this is how you work out the RMS of an array of values:
[code]<?php
function rms() {
    $vals = func_get_args();
    $new = "";
    foreach($vals as $n) $new += pow($n,2);
    $new = sqrt($new / count($vals));
    echo $new;
}
?>[/code]
Someone that [i]is[/i] good at maths, please do go ahead and correct me if I'm wrong.

Share this post


Link to post
Share on other sites
[quote author=brown2005 link=topic=102059.msg404528#msg404528 date=1154006335]
ok.. ill try.. so in a rating system wat would you use, just a normal average?
[/quote]Personally, yes. Maybe you could filter out all ratings that are full of 1's...

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.