Issue with Python

Please support our Python advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Sep 2007
Posts: 10
Reputation: rjmiller is an unknown quantity at this point 
Solved Threads: 0
rjmiller rjmiller is offline Offline
Newbie Poster

Issue with Python

 
0
  #1
Dec 5th, 2007
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
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 1,054
Reputation: woooee is a jewel in the rough woooee is a jewel in the rough woooee is a jewel in the rough 
Solved Threads: 297
woooee woooee is offline Offline
Veteran Poster

Re: Issue with Python

 
0
  #2
Dec 6th, 2007
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
  1. def laplace_func(a, b, c):
  2. return a+b-c
  3. #
  4. if __name__ == '__main__':
  5. laplace_list=[ [1 ,2 ,3],
  6. [3, 2, 1],
  7. [1, 3, 2]]
  8. for eachlist in laplace_list:
  9. result = laplace_func(eachlist[0], eachlist[1], eachlist[2])
  10. 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
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for Python
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC