A detailed explanation of how PHP calculates the stability of student performance

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.