Elementary functions for statistics Just find the area of the graph of the normal distribution according to N (0,1 ^ 2).
↑ This
The formula for this polyp-like curve is
NORMAL_Dist_S
def NORMAL_Dist_S(a):
"""N(0,1^2)Normal distribution x according to=Returns the area from 0 to a"""
import numpy as np
import math
from scipy import integrate
f = lambda x: (math.exp(-x**2/2)) / math.sqrt(2*math.pi)
s,d = integrate.quad(f, 0, abs(a))
return s
NORMAL_Dist_S is
x = any real number res = NORMAL_Dist_S(x) And write
Returns the value of S (x) in res.
NORMAL_Dist_S_REST
def NORMAL_Dist_S_REST(a):
"""N(0,1^2)Normal distribution x according to=Area from 0 to a is 0.Returns the value subtracted from 5"""
import numpy as np
import math
from scipy import integrate
f = lambda x: (math.exp(-x**2/2)) / math.sqrt(2*math.pi)
s,d = integrate.quad(f, 0, abs(a))
s=0.5-s
return s
NORMAL_Dist_S_REST is
x = any real number res = NORMAL_Dist_S_REST(x) And write Returns the value of S (x) in res.
NORMAL_Dist
def NORMAL_Dist(a,b):
"""N(0,1^2)Returns the area from a to b of the normal distribution according to"""
import numpy as np
import math
from scipy import integrate
f = lambda x: (math.exp(-x**2/2)) / math.sqrt(2*math.pi)
s,d = integrate.quad(f, a,b)
return s
NORMAL_Dist is
x = any real number y = any real number res = NORMAL_Dist(x,y) And write Returns the value of S (x) in res.
Let's call it simpler, clearer and faster Therefore, who gets the function.
I want to increase the number of functions steadily. (Who is the best !! ??) After all, there are quite a few situations where I use it, It's annoying, so take this opportunity to make it a function.
At this level, I think there is something in the python import library. Rather, it cannot be absent.
http://org-technology.com/posts/integrate-function.html https://ja.wikipedia.org/wiki/%E6%AD%A3%E8%A6%8F%E5%88%86%E5%B8%83
Recommended Posts