On Thu, 10 Nov 2005, Jacob Last wrote:
In fact I don't think you can compute the cumulative gaussian distribution from a closed formula...
It depends which are the allowed building blocks for the formula. If all you have is +,-,*,/,pow,exp,log,cos, then you can't.
then the MacLaurin expansion of integral(exp(-x*x)) is:
Sum of x(-x*x)^k / (k+1)! for k=0 and upwards
Which is a bitch to compute, since it needs so many terms to get it accurate.
However, <math.h> has a function erf() which computes exactly that, and it's prolly a good optimisation over computing the series naïvely.
i think that a sigmoid function might be better suited than the hyperbolic tangent....
The hyperbolic tangent *IS* a sigmoid!
tanh(t) = 1-2*P(-2*t)
Mathieu Bouchard - tél:+1.514.383.3801 - http://artengine.ca/matju Freelance Digital Arts Engineer, Montréal QC Canada