[SciPy-User] solving integration, density function
Gregor Thalhammer
Gregor.Thalhammer@gmail....
Tue Dec 21 06:20:47 CST 2010
Am 21.12.2010 um 12:06 schrieb Johannes Radinger:
> Hello,
>
> I am really new to python and Scipy.
> I want to solve a integrated function with a python script
> and I think Scipy should do that :)
>
> My task:
>
> I do have some variables (s, m, K,) which are now absolutely set, but in future I'll get the values via another process of pyhton.
>
> s = 400
> m = 0
> K = 1
>
> And have have following function:
> (1/((s*K)*sqrt(2*pi)))*exp((-1/2*(((x-m)/s*K))^2) which is the density function of the normal distribution a symetrical curve with the mean (m) of 0.
>
> The total area under the curve is 1 (100%) which is for an integration from -inf to +inf.
> I want to know x in the case of 99%: meaning that the integral (-x to +x) of the function is 0.99. Due to the symetry of the curve you can also set the integral from 0 to +x equal to (0.99/2):
>
> 0.99 = integral((1/((s*K)*sqrt(2*pi)))*exp((-1/2*(((x-m)/s*K))^2)), -x, x)
> resp.
> (0.99/2) = integral((1/((s*K)*sqrt(2*pi)))*exp((-1/2*(((x-m)/s*K))^2)), 0, x)
>
> How can I solve that question in Scipy/python
> so that I get x in the end. I don't know how to write
> the code...
--->
erf(x[, out])
y=erf(z) returns the error function of complex argument defined as
as 2/sqrt(pi)*integral(exp(-t**2),t=0..z)
---
from scipy.special import erf, erfinv
erfinv(0.99)*sqrt(2)
Gregor
>
> thank you very much
>
> johannes
> --
> Sicherer, schneller und einfacher. Die aktuellen Internet-Browser -
> jetzt kostenlos herunterladen! http://portal.gmx.net/de/go/atbrowser
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
More information about the SciPy-User
mailing list