note 101047 added to function.stats-stat-percentile

From: Date: Tue, 23 Nov 2010 02:30:17 +0000
Subject: note 101047 added to function.stats-stat-percentile
Groups: php.notes 
Request: Send a blank email to php-notes+get-174276@lists.php.net to get a copy of this message
The erf(x) example offered is a little imprecise for my needs. Here is an adaptation for PHP of one I found on a Python site: function erf($x) { // Unreliable for $x >= sqrt(3) $u0 = $x; $u1 = -$x*$x*$x/3.; $n = 0; $r = $u0; while ( abs($u0) > abs($u1) ) { $n += 1; $u0 = $u1; $u1 = -$u0*$x*$x*(2*$n+1)/(($n+1)*(2*$n+3)); $r += $u0; } if ( $x > sqrt(3.0) ) { echo " <P>This version of the \"exact\" erf(<i>x</i>) only works for <i>x</i> &lt;= sqrt(3)!<P> "; } return (2/sqrt(M_PI))*$r; } Note the warning message. ---- Server IP: 69.147.83.197 Probable Submitter: 24.87.16.153 ---- Manual Page -- http://www.php.net/manual/en/function.stats-stat-percentile.php Edit -- https://master.php.net/note/edit/101047 Del: integrated -- https://master.php.net/note/delete/101047/integrated Del: useless -- https://master.php.net/note/delete/101047/useless Del: bad code -- https://master.php.net/note/delete/101047/bad+code Del: spam -- https://master.php.net/note/delete/101047/spam Del: non-english -- https://master.php.net/note/delete/101047/non-english Del: in docs -- https://master.php.net/note/delete/101047/in+docs Del: other reasons-- https://master.php.net/note/delete/101047 Reject -- https://master.php.net/note/reject/101047 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#174276) next »