note 92002 deleted from function.stats-dens-normal by danbrown
| From: | danbrown@php.net | Date: | Sat, 04 Jul 2009 15:17:38 +0000 |
| Subject: | note 92002 deleted from function.stats-dens-normal by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-157912@lists.php.net to get a copy of this message | ||
Note Submitter: Baptiste Deleplace
----
stats_dens_normal is similar to http://fr.wikipedia.org/wiki/Fonction_gaussienne
and can be manually done like this
<?php
function nlaNormalDens($x,$es,$et){
return exp(-pow(($x-$es),2)/(2*pow($et,2)))/($et*sqrt(2*M_PI));
}
// $x the value that you want the density
?>
IE
<?php
$n = -2;
while($n < 2){
echo nlaNormalDens($n,0,1)."<br>";
$n = $n + 0.1;
}
echo "<hr>";
$n = -2;
while($n < 2){
echo stats_dens_normal($n,0,1)."<br>";
$n = $n + 0.1;
}
?>
will give you
0.053990966513188
0.065615814774677
0.078950158300894
0.094049077376887
0.11092083467946
0.12951759566589
0.14972746563574
0.17136859204781
0.19418605498321
0.21785217703255
0.24197072451914
0.26608524989876
0.28969155276148
0.31225393336676
0.3332246028918
0.3520653267643
0.36827014030332
0.38138781546052
0.39104269397546
0.39695254747701
0.39894228040143
0.39695254747701
0.39104269397546
0.38138781546052
0.36827014030332
0.3520653267643
0.3332246028918
0.31225393336676
0.28969155276148
0.26608524989875
0.24197072451914
0.21785217703255
0.19418605498321
0.17136859204781
0.14972746563574
0.12951759566589
0.11092083467946
0.094049077376887
0.078950158300894
0.065615814774676
---------------------------------------------
0.053990966513188
0.065615814774677
0.078950158300894
0.094049077376887
0.11092083467946
0.12951759566589
0.14972746563574
0.17136859204781
0.19418605498321
0.21785217703255
0.24197072451914
0.26608524989876
0.28969155276148
0.31225393336676
0.3332246028918
0.3520653267643
0.36827014030332
0.38138781546052
0.39104269397546
0.39695254747701
0.39894228040143
0.39695254747701
0.39104269397546
0.38138781546052
0.36827014030332
0.3520653267643
0.3332246028918
0.31225393336676
0.28969155276148
0.26608524989875
0.24197072451914
0.21785217703255
0.19418605498321
0.17136859204781
0.14972746563574
0.12951759566589
0.11092083467946
0.094049077376887
0.078950158300894
0.065615814774676