[SciPy-user] Boolean Algebra
Perez Kawumi
pepe_kawumi@yahoo.co...
Tue Aug 21 07:08:15 CDT 2007
Hi,
Can someone please tell me where I can find any information regarding how boolean algebra is used in python. This is the piece of code im trying to write I have just used dummy variables for the matrices and the other different values. Just want to know if there is anything I should watch out for when I get the actual values for the different matrices coz they will most probably be floating point numbers.
And I'm trying to return dof_flag at the end. I initially want all the elements of the vector dof_flag = 1. Is this the right way of doing this or is there any other smarter way of doing this coz I want to return dof_flag as a vector at the end
Thanks
dof_flag = []
dof_flag = ones((1,5))
NUM_EDGES = 2
b=1
print dof_flag
node1 =[]
print node1
node2 =[]
print node2
EDGES =ones((3,4))
NODE_COORD =ones((3,4))
eps = 3
print EDGES
print NODE_COORD
for i_edge in range(0, NUM_EDGES):
node1 = EDGES[i_edge,1]
print node1
node2 = EDGES[i_edge,2]
print node2
#i.e. y =0
if (abs(NODE_COORD[node1,2]) < eps) & (abs(NODE_COORD[node2,2]) <eps):
dof_flag[i_edge] = 0
#i.e. y =b
if abs((NODE_COORD[node1,2])-b) < eps & abs((NODE_COORD[node2,2])-b) <eps:
dof_flag[i_edge] = 0
#i.e. x =0
if abs(NODE_COORD[node1,1]) < eps & abs(NODE_COORD[node2,1]) <eps:
dof_flag[i_edge] = 0
#i.e. x =a
if abs((NODE_COORD(node1,1))-a) < eps & abs((NODE_COORD(node2,1))-a) <eps:
dof_flag[i_edge] = 0
___________________________________________________________
To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre. http://uk.security.yahoo.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/scipy-user/attachments/20070821/c842b8d1/attachment.html
More information about the SciPy-user
mailing list