# [SciPy-user] returning floats from a function

Perez Kawumi pepe_kawumi@yahoo.co...
Sat Sep 8 06:15:42 CDT 2007

```Hi,
im having problems returning floating point numbers in the whitney_function matrices at the end of my program. The answers are being rounded off to whole numbers. I think it might be the way im defining my whitney_functions initially(the first highlighted block). Please help.
Thanks Perez

def whitney(elem_num,x,y):

global ELEMENTS, NODE_COORD

whitney_functions = []
whitney_functions = zeros((3,2))

perez  = simplex2D(elem_num,x,y)
trinodes = ELEMENTS[[elem_num],:]-1

x1 = NODE_COORD[trinodes[0,0],0]
y1 = NODE_COORD[trinodes[0,0],1]
x2 = NODE_COORD[trinodes[0,1],0]
y2 = NODE_COORD[trinodes[0,1],1]
x3 = NODE_COORD[trinodes[0,2],0]
y3 = NODE_COORD[trinodes[0,2],1]
#area = 0.5*abs(det([1 x1 y1; 1 x2 y2; 1 x3 y3]));
temp = linalg.inv(([x1,x2,x3],[y1,y2,y3],[1,1,1]))
b = temp[:,[0]]
c = temp[:,[1]]
nabla_lambda  = temp[:,0:2]

whitney_functions[[0],:] = perez[0]*nabla_lambda[[1],:] - perez[1]*nabla_lambda[[0],:]
whitney_functions[[1],:] = perez[0]*nabla_lambda[[2],:] - perez[2]*nabla_lambda[[0],:]
whitney_functions[[2],:] = perez[1]*nabla_lambda[[2],:] - perez[2]*nabla_lambda[[1],:]
return whitney_functions

___________________________________________________________
Want ideas for reducing your carbon footprint? Visit Yahoo! For Good  http://uk.promotions.yahoo.com/forgood/environment.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/scipy-user/attachments/20070908/7b0214b1/attachment.html
```