我想知道如何通过对从 890 到 910(含)的 x 值使用循环在 Python 中键入以下公式(请查看下面的图片):
我的代码:
# PURPOSE : Evaluate cumulative probabilities for a normal distribution, sum an infinite series and convert the infinite series to integers
import math
m_ = 900 # identifier for normal distribution mean [mm]
s_d = 1 # identifier for normal distribution standard deviation [mm]
print "DISTRIBUTION OF A PLATE WIDTH:" " MEAN", "=",m_,"," "STD DEV", "=", s_d
print ""
print "Using functions from the math library ..."
# The probability density function(pdf) for a normal distribution with mean m_ and standard deviation s_d
xx = 890
print "x" " " " f(x)" " " " F(x)"
while xx < 911:
print xx
xx = xx + 1
print (1 / ((s_d * (math.sqrt(2 * math.pi) * math.exp((- (x - m_) ** 2) / (2 * (s_d) ** 2)