python语法错误输出

时间:2013-02-01 05:54:49

标签: python

请帮我修复我的代码错误。当我打印最后一行时,我收到语法错误消息:

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    
ftotal = 0
term = 0.0
count = 0
while abs(term) > 911:
    ftotal += term
    count += 1
    term = term * xx / float(count)


print "x"  "          " " f(x)" "           " " F(x)"
print "890" ""  (1 / ((s_d * (2 * math.pi) ** -0.5)) * math.exp((- (x - m_) ** 2) / (2 * (s_d) ** 2),   0.5 * (1 + math.erf((x - m_) / s_d * m.sqrt(2))

1 个答案:

答案 0 :(得分:3)

在while循环之前定义x。从你用x90表示的最后两行,所以我猜x = 890

x = 890
#your while loop goes here

print "x"  "          " " f(x)" "           " " F(x)"
print "890" ,  (1 / ((s_d * (2 * math.pi) ** -0.5))) * math.exp((- (x - m_) ** 2) / (2 * (s_d) ** 2))  , 0.5 * (1 + math.erf((x - m_) / s_d * math.sqrt(2)))

我不记得确切的公式,但如果正确放置上述表达式,则不会出现语法错误。