On 24/10/11 16:48, kcrisman wrote:
Unless the Gaussian distribution is only the one centered at zero and
the normal is able to be centered anywhere? But I've never heard of
that as a distinction...
I though (not sure about that) that normal is a type of Gaussian
distribution with location =0 and scale=1
For sure we want to start unifying this behavior. Scipy is good to
have as an option, of course, but we want more Sage-"native" wrapping
of things like GSL (which I think #11572 is going for?). Thanks for
catching this and working on that ticket; kamhamea/Mato did a lot of
good work on that ticket, and it would be a real shame to have it
bitrot further.
I am working on that.
I tend to use Sage when possible and use the following implementation
def norm_pdf(mu, sigma):
"""
returns a Sage function with the probability density function
of a gaussian distribution
mu -- mean
sigma -- standard deviation
Examples:
>>> mynorm = norm_pdf(mu=0, sigma =1)
>>> mynorm(0)
>>> 1/2*sqrt(2)/sqrt(pi)
>>> mynorm(0).n()
>>> 0.398942280401433
"""
z = 1.0*(x-mu)/sigma
exp = e^(-0.5*z^2)
C = sqrt(2*pi)*sigma
f(x) = 1.0*exp/C
return f
--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org