Hướng dẫn dùng binomial cdf trong PHP
Definition and UsageThe stats_cdf_binomial() function can calculate any one parameter of binomial distribution given values for the others. Syntaxfloat stats_cdf_binomial ( float $par1, float $par2, float $par3, int $which ) Parameters
Return ValuesReturns CDF, x, n, or p, determined by which. The kind of the return value and parameters (par1, par2, and par3) are determined by which. Return value and parametersThe following table lists the return value and parameters by which.
DependenciesThis function was first introduced in statistics extension (PHP 4.0.0 and PEAR 1.4.0). We have used latest release of stats-2.0.3 (PHP 7.0.0 or newer and PEAR 1.4.0 or newer) for this tutorial. ExampleIn the following example when which=1, calculate P from (S, XN, PR).
OutputThis will produce following result − float(0.216) ExampleIn the following example when which=2, calculate S from (P, XN, PR).
OutputThis will produce following result − float(1) ExampleIn the following example when which=3, calculate XN from (P, S, PR).
OutputThis will produce following result − float(3) ExampleIn the following example when which=4, calculate PR from (P, S, XN).
OutputThis will produce following result − float(0.7) ExampleFollowing is an error case. In the following example which<1, warning is displayed in logs. OutputThis will produce following result and a warning in logs PHP Warning: stats_cdf_binomial(): Fourth parameter should be in the 1..4 range bool(false) ExampleFollowing is an error case. In the following example which>4, warning is displayed in logs. 4 ?> OutputThis will produce following result and a warning in logs PHP Warning: stats_cdf_binomial(): Fourth parameter should be in the 1..4 range bool(false) |