python编写数学公式大全_python - 用python编写数学公式 - 堆栈内存溢出
我正在用python編寫此公式。 請查看圖片我正在使用以下代碼。 它總是會出錯。
import math
import matplotlib
matplotlib.use('TkAgg')
from pylab import *
import cmath
import networkx as nx
import random as rd
import numpy as np
g=nx.karate_club_graph()
for i in g.nodes_iter():
g.node[i]['theta']=1
a=abs((cmath.exp( (g.node[i]['theta']*(1j)) for i in g.nodes_iter()))/g.number_of_nodes())
我得到以下回溯
runfile('C:/Users/Bhawesh/Desktop/workingdirectory/bookpractice.py', wdir='C:/Users/Bhawesh/Desktop/workingdirectory')
Traceback (most recent call last):
File "", line 1, in
runfile('C:/Users/Bhawesh/Desktop/workingdirectory/bookpractice.py', wdir='C:/Users/Bhawesh/Desktop/workingdirectory')
File "C:\Users\Bhawesh\Anaconda2\lib\site-packages\spyder\utils\site\sitecustomize.py", line 866, in runfile
execfile(filename, namespace)
File "C:\Users\Bhawesh\Anaconda2\lib\site-packages\spyder\utils\site\sitecustomize.py", line 87, in execfile
exec(compile(scripttext, filename, 'exec'), glob, loc)
File "C:/Users/Bhawesh/Desktop/workingdirectory/bookpractice.py", line 20, in
a=abs((cmath.exp( (g.node[i]['theta']*(1j)) for i in g.nodes_iter()))/g.number_of_nodes())
TypeError: a float is required
總結
以上是生活随笔為你收集整理的python编写数学公式大全_python - 用python编写数学公式 - 堆栈内存溢出的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 关系查询处理 查询优化 论文_每日论文3
- 下一篇: .net mvc actionresul