Home  >  Article  >  php教程  >  计算正态分布

计算正态分布

PHP中文网
PHP中文网Original
2016-05-26 08:18:462029browse

计算正态分布

<?php

/**
 * 根据分割积分法来求得积分值
 * -3.89~3.89区间外的积分⾯积 ⼩于0.0001,
 * 所以确定有效的积分区间为-3.89~3.89
 * 在实现分割的时候精度定为0.0001,得到的结果和查表得到的结果误差在-0.0002~+0.0002之间
(已经检验)
 *
 * @param u  积分上限
 * @return  积分值
 */
function selfCaculat($u) {
	$ret = 0;

	if ($u < -3.89) {
		$ret = 0.01;
		return $ret;
	} else if ($u > 3.89) {
		$ret = 0.99;
		return $ret;
	}

	$temp = -3.89;
	while ($temp  0) {
		$ret = selfCaculat($seed);
	} else {
		$ret = 1 - selfCaculat(-$seed);
	}

	$ret = intval(100 * $ret);

	return $ret;
}

?>

                   

以上就是计算正态分布的内容,更多相关内容请关注PHP中文网(www.php.cn)!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:演示defineNext article:演示const