brown2005 Posted July 27, 2006 Share Posted July 27, 2006 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. Link to comment https://forums.phpfreaks.com/topic/15799-root-mean-square/ Share on other sites More sharing options...
zq29 Posted July 27, 2006 Share Posted July 27, 2006 [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? Link to comment https://forums.phpfreaks.com/topic/15799-root-mean-square/#findComment-64615 Share on other sites More sharing options...
brown2005 Posted July 27, 2006 Author Share Posted July 27, 2006 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 Link to comment https://forums.phpfreaks.com/topic/15799-root-mean-square/#findComment-64616 Share on other sites More sharing options...
zq29 Posted July 27, 2006 Share Posted July 27, 2006 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]<?phpfunction 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. Link to comment https://forums.phpfreaks.com/topic/15799-root-mean-square/#findComment-64623 Share on other sites More sharing options...
brown2005 Posted July 27, 2006 Author Share Posted July 27, 2006 ok.. ill try.. so in a rating system wat would you use, just a normal average? Link to comment https://forums.phpfreaks.com/topic/15799-root-mean-square/#findComment-64631 Share on other sites More sharing options...
zq29 Posted July 27, 2006 Share Posted July 27, 2006 [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... Link to comment https://forums.phpfreaks.com/topic/15799-root-mean-square/#findComment-64646 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.