943,984 Members | Top Members by Rank

Ad:
  • Python Discussion Thread
  • Unsolved
  • Views: 531
  • Python RSS
Dec 5th, 2007
0

Issue with Python

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
rjmiller is offline Offline
10 posts
since Sep 2007
Dec 6th, 2007
0

Re: Issue with Python

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
Python Syntax (Toggle Plain Text)
  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
Reputation Points: 741
Solved Threads: 692
Nearly a Posting Maven
woooee is offline Offline
2,307 posts
since Dec 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Python Forum Timeline: How to pass the parameters to a script?
Next Thread in Python Forum Timeline: URL conversion





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC