德拜理论的Python代码给出了一个语法错误
我在Python中输入了这段代码,得到了语法错误:b=Od/T的语法无效。这与它的定义有关吗?我怎样才能修好它德拜理论的Python代码给出了一个语法错误,python,python-3.x,Python,Python 3.x,我在Python中输入了这段代码,得到了语法错误:b=Od/T的语法无效。这与它的定义有关吗?我怎样才能修好它 import scipy.integrate as sci import scipy.constant as scc import math import numpy as np import matplotlib.pyplot as plt from IPython import get_ipython get_ipython().run_line_magic('matplotlib
import scipy.integrate as sci
import scipy.constant as scc
import math
import numpy as np
import matplotlib.pyplot as plt
from IPython import get_ipython
get_ipython().run_line_magic('matplotlib', 'inline')
def f(T):
n=6.022*(10**28)
Od=429
V=10**(-3)
ft=lambda x: ((x**4)*math.exp(x)/(((math.exp(x))-1**2))
b = Od/T
a=0
C=9*V*n((T/Od)**3)*scc.k*(sci.quad(ft,a, b.any(),limit=10))[0]
return C
T1=np.arange(5,500,1)
plt.plot(T1,f(T1),'r-')
上一行缺少右括号:
ft=lambda x: ((x**4)*math.exp(x)/(((math.exp(x))-1**2))
# ^ This parenthesis is never closed.
在那之前的行中有错误。你可以试试这个
fr=lambda x: (x**4)*math.exp(x)/((math.exp(x))-1**2)
去掉括号,现在显示:ModuleNotFoundError:没有名为'scipy.constant'的模块@NotEinstein:这是一个单独的问题,应该作为单独的问题提出。