Jump to content


Photo

root-mean-square


  • Please log in to reply
5 replies to this topic

#1 brown2005

brown2005
  • Members
  • PipPipPip
  • Advanced Member
  • 943 posts

Posted 27 July 2006 - 12:21 PM

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.

#2 Kris

Kris
  • Staff Alumni
  • Advanced Member
  • 2,755 posts
  • LocationThe Internet

Posted 27 July 2006 - 12:25 PM

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.

I don't fully understand, do you want to know how to calculate the RMS of an array of values?

#3 brown2005

brown2005
  • Members
  • PipPipPip
  • Advanced Member
  • 943 posts

Posted 27 July 2006 - 12:28 PM

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

#4 Kris

Kris
  • Staff Alumni
  • Advanced Member
  • 2,755 posts
  • LocationThe Internet

Posted 27 July 2006 - 12:50 PM

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:
<?php
function rms() {
    $vals = func_get_args();
    $new = "";
    foreach($vals as $n) $new += pow($n,2);
    $new = sqrt($new / count($vals));
    echo $new;
}
?>
Someone that is good at maths, please do go ahead and correct me if I'm wrong.

#5 brown2005

brown2005
  • Members
  • PipPipPip
  • Advanced Member
  • 943 posts

Posted 27 July 2006 - 01:18 PM

ok.. ill try.. so in a rating system wat would you use, just a normal average?

#6 Kris

Kris
  • Staff Alumni
  • Advanced Member
  • 2,755 posts
  • LocationThe Internet

Posted 27 July 2006 - 02:04 PM

ok.. ill try.. so in a rating system wat would you use, just a normal average?

Personally, yes. Maybe you could filter out all ratings that are full of 1's...




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users