This article mainly introduces PHP based on variance and standard deviation to calculate the stability of student performance, involving the operation of PHP math operations skills, the need for friends to refer to. We hope to help you.
The student in the project has a personal growth file module, which requires the students ' performance stability to be analyzed by fluctuation collection according to the 10 test results. Learning maths knows that this should be done using the variance in mathematics. Because it is a mathematical slag, have to read the relevant instructions and formulas on the net, see
Well, with the formula, that's good to do, then the set of formulas.
$arr 1 = Array (2, +, +), $arr = Array (Variance, N, (), (), function ($arr) { $length = count ($arr); if ($length = = 0) { return array (0,0); } $average = Array_sum ($arr)/$length; $count = 0; foreach ($arr as $v) { $count + = POW ($average-$v, 2); } $variance = $count/$length; The return array (' variance ' = $variance, ' square ' = sqrt ($variance), ' average ' = $average); Print_r (Variance ($arr 1));p Rint_r (Variance ($arr 2));
The above code prints
Array ( [variance] = 536 [Square] = 23.15167380558 [average] = +) Array ( [variance] = 3.6 [Square] = 1.897366596101 [average] + 72)
By looking at data discovery, although the average of two arrays is the same, the array 1 is volatile, the results are unstable, and the array 2 fluctuates smaller than the array 1 stable.
Related recommendations:
Explain how PHP can display 16-binary image data to a Web page
A detailed explanation of how PHP prevents Thunder download method
A detailed explanation of how PHP implements Sudoku solution