User Name
Password
AppleNova Forums » Programmer's Nook »

Need some massive help in Python...


Register Members List Calendar Search FAQ Posting Guidelines
Need some massive help in Python...
Thread Tools
RowdyScot
Ice Arrow Sniper
 
Join Date: Apr 2005
Location: Great Bay Temple
Send a message via AIM to RowdyScot Send a message via Skype™ to RowdyScot 
2006-10-10, 00:08

So for my modern physics class, I'm supposed to create a program in Python to demonstrate a simple harmonic oscillator based off of the Schroedinger equation for n=0, n=1, and n=2. Mind you, NOBODY in this class has any programming knowledge, other than some HTML and bits and pieces of Java. I do not know Python well at all. The program should find the probabilty of the particle's location in the interval -x to x (can presumably be -1 to 1) and also give the energy. So...ummm...yeah. I understand enough to know what to use for xmin and xmax, and dx can just be a step to whatever suits the needs, but I'm not sure what equations I should be using. I know that the energy is (n + 1/2)*hbar*omega, where hbar is h/(2*pi) or 1.054*10**-34, and omega can just be set to 1 radian/second. I'm not sure how to get the probability because of some massive math issues. I can make things easier by defining a bunch of things to cancel out, such as setting k and m as 1.054*10**-34, and so on for the variables in Schroedinger's. My issue mathematically is when I have to solve Schroedinger's for modes n=0, 1, and 2. This gives me a ton of ugly, which I'm not sure how to code. So my question is, does anyone understand what I'm trying to do enough to help, and is anyone willing to help? I know when completely scripted, the code really shouldn't be more than 20 lines. Easy enough, right? This is unfortunately due Wednesday the 11th, so I'm already on a strict timetable. If somebody can give me an example, or help me understand mathematically what I should be doing, I think I can get the rest from there. Honestly, I'm not sure if this is where this thread should belong, but I figured as much since I am trying to make an application. If it should be in AppleOutsider, my humble apologies. I'm currently running on VPython in X11. Thanks for any help that I can get. It is extremely appreciated.

Authentic Nova Scotia bagpipe innards
  quote
Kickaha
Likes his boobies blue.
 
Join Date: May 2004
Location: Hell
 
2006-10-10, 00:13

Oy - I'm more help with the Python than the math, it's been years since I did any QM... :/

What are the massive math issues you're having? Precision problems?

My other brain is hung like a horse too.
#IRC isn't old school.
Old school is being able to say 'finger me' with a straight face.

Last edited by Kickaha : 2006-10-10 at 00:22.
  quote
RowdyScot
Ice Arrow Sniper
 
Join Date: Apr 2005
Location: Great Bay Temple
Send a message via AIM to RowdyScot Send a message via Skype™ to RowdyScot 
2006-10-10, 00:32

Arg...well, I've started out by deriving the Schroedinger equation in order to get energy. Solving through all of that is how I get the value in my above post of E = (n + 1/2)*hbar*omega. However, I'm not sure how I should be getting probability. Wait...maybe I've just realized something. If I derived the Schroedinger equation to get E, I should just be coding for ∫[(n + 1/2)*hbar*omega], right? How do I go about setting that up with limits from -x to x, which I can just say are -1 and 1, respectively? The whole integration in Python still throws me a bit.

Authentic Nova Scotia bagpipe innards
  quote
Kickaha
Likes his boobies blue.
 
Join Date: May 2004
Location: Hell
 
2006-10-10, 00:38

Unless you can find an intergration package, you're going to have to code up an approximation algorithm like Runge-Kutta or Newton's approximation. If you go with R-K, a 4th order method gives you a good convergence with pretty good performance. (Wow, I hope you know this is hitting some neurons in my skull that have cobwebs...)

My other brain is hung like a horse too.
#IRC isn't old school.
Old school is being able to say 'finger me' with a straight face.
  quote
RowdyScot
Ice Arrow Sniper
 
Join Date: Apr 2005
Location: Great Bay Temple
Send a message via AIM to RowdyScot Send a message via Skype™ to RowdyScot 
2006-10-10, 00:51

Hopefully these aren't too unpleasant memories Some quick looking around at R-K might do that which I'm looking for, and I think I know how to set everything up. I think I wasn't seeing something that was obvious the entire time, which is a normal thing for me If anything else comes up, I'll ask with something hopefully a little more specific. Thanks a lot for your help, Kick. Dunno that I'd have been able to find that without knowing what to look for.

Authentic Nova Scotia bagpipe innards
  quote
Posting Rules Navigation
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Post Reply

Forum Jump
Thread Tools
Similar Threads
Thread Thread Starter Forum Replies Last Post
Python -- Directory content differences Wickers Programmer's Nook 12 2006-03-19 13:32
Python in Xcode Oskar Programmer's Nook 7 2006-02-04 16:23
Python vs Alligator Matsu AppleOutsider 3 2005-10-06 22:10
Python Failure after Tiger Upgrade Caseyfern Genius Bar 0 2005-05-23 11:36
Massive Assault ... Good game? NeverFade Third-Party Products 0 2005-01-21 21:12


« Previous Thread | Next Thread »

All times are GMT -5. The time now is 12:47.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright ©2004 - 2020, AppleNova