Home > php教程 > PHP源码 > 计算正态分布

计算正态分布

PHP中文网
Release: 2016-05-26 08:18:46
Original
2064 people have browsed it

计算正态分布

<?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;
}

?>
Copy after login

                   

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

Related labels:
source:php.cn
Statement of this Website
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
Latest Articles by Author
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template