954,546 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Issue with Python

Quick question,

I'm not sure how to go about asking this, but I am attempting to write a Laplacian of a scalar field (general function f). I want to be able to put this in an array in order to solve it multiple times. I don't really know how to go about this. any help would be great.

Thanks,

Miller

rjmiller
Newbie Poster
10 posts since Sep 2007
Reputation Points: 10
Solved Threads: 0
 

I think you would use a function and pass variables to it. So if the Laplace operator is a+b-c you could do something like

def laplace_func(a, b, c):
   return a+b-c
#
if __name__ == '__main__':
   laplace_list=[ [1 ,2 ,3],
                   [3, 2, 1],
                   [1, 3, 2]]
   for eachlist in laplace_list:
      result = laplace_func(eachlist[0], eachlist[1], eachlist[2])
      print "result =", result, "for", eachlist


If this isn't even close to what you want, post some sample data and describe what you want to do with it

woooee
Nearly a Posting Maven
2,454 posts since Dec 2006
Reputation Points: 777
Solved Threads: 714
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You