Skip to content Skip to sidebar Skip to footer

Write Math Formula In Python

This is the value I want to calculate. I am writing it as follows, here i is the imaginary number.I am using python and networkx.Can someone help. import math import matplotlib ma

Solution 1:

Python's sqrt operation doesn't support negative integers. However, numpy works with complex numbers. The imaginary number $i$ is given by 1j in Python. So you will have to convert your equation to:

a=abs((np.exp( (g.node[i]['theta']*(1j)) for i in g.nodes_iter()))/g.number_of_nodes())

Post a Comment for "Write Math Formula In Python"