from sympy import *
H,B = symbols('H, B')
H = FiniteSet('A', 'B', 'C', 'E', 'F')
B = FiniteSet('Joe', 'Jack', 'Sue', 'Jill')
N = Union(H,B)
# how would I do something like this?
for n in N:
#perform some operation
foo(n)
Addendum:
In my case, I'd actually like to iterate over the set to create nodes and
vertices in NetworkX
import networkx as nx
G = nx.DiGraph()
G.add_node("A")
G.add_node("B")
etc.
G.add_edge("A", "B")
etc.
# Then I can draw it in iPython notebook
nx.draw(G, node_size=90, node_color='Red')
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit
https://groups.google.com/d/msgid/sympy/dbc6b35d-d2d8-4d96-8032-d66909760ecd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.