Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Would This be a Good Programming "Physics" Project?

  1. Jan 1, 2016 #1
    I have recently been doing a lot of programming in python for the past year or so, and consider myself to be okay with the language. I also have some experience with mathematical languages like the Wolfram language and Maple. Other than that, I am willing to learn C, C++, or Java for this project (and plan to learn them anyway soon.) I am a physics major in my senior year of undergraduate, and have had training mostly in physics. This would be a project spanning months, and mostly done in my spare time.

    Lately I have had a wild imagination, and have been thinking a lot about the population density of a populated solar system in the future. Let's say that the people inhabiting this solar system can live and function well in space (they live on space stations.) The population centers would likely be around planets but maybe also areas with many resources (i.e asteroid belts, moons.) Generally though, the program would allow for somebody to select these as variable initial conditions or maybe they would be dependent on the gravitational mass somehow (disregarding things like the Sun.)

    Other than the basic population growth laws, I was also interested in the way people would move from one population center to another. In my research I discovered the following.

    https://en.wikipedia.org/wiki/Demographic_gravitation

    After reading the article published in 1947 by John Quincy Stewart which approximates demographic movement between population centers using the following formula, I want to apply these "laws" using generalized initial conditions to create a 3D visualization (represented by dots) of population centers and vectors which represent the motion from one center to another (lets say they are low resolution, of the order of "city-stations" with populations of tens of millions and I would have a few hundred or thousands of these.) Since these laws follow a similar form to the gravitational laws I figured the calculations would be similar to gravitational calculations, which I have done in python before.

    So basically my question is, do you think I would be able to pull this off with just Python/vPython on the scale I want? Would I need a supercomputer to do this, or can I accomplish this with the resources of a personal computer? I'd imagine that it would come out to be similar to an n-body problem. I haven't done any n-body simulations, and have no idea about the limitations of these. Is my assumption correct?

     
    Last edited: Jan 1, 2016
  2. jcsd
  3. Jan 1, 2016 #2

    phyzguy

    User Avatar
    Science Advisor

    This sounds like an interesting problem to me. With hundreds of thousands of dots, this should be well within the capabilities of Python running on a laptop. If some part of it is too slow, you could convert that part to C or C++ to speed it up, which you said you wanted to learn anyway. I suggest using Python's OOP capabilities to set it up.
     
  4. Jan 1, 2016 #3
    Interesting perhaps, but not really physics.
     
  5. Jan 1, 2016 #4
    Thanks. I am probably going to use a desktop with an i5 4690k and AMD r9 280 (I use this desktop for video games) so it is nice to hear that a common laptop would probably be able to do this. I was also looking into using pyopengl and pyopencl like somebody did in the following video, but I haven't used these before.

    Yeah that's why I used the quotation marks. Although it is described as "social physics" which I guess is a term used for sociology that uses a lot of mathematical and computational principles which were developed for physics applications, like there is a field called econo-physics which does the same but instead when applied to economics rather than sociology. The project doesn't need to be a physics one.
     
  6. Jan 1, 2016 #5

    Mark44

    Staff: Mentor

    My thoughts were similar to those of Dr. Courtney, in that it seemed more about sociology that physics per se, but if the project doesn't have to be "physics-y" then maybe it's OK.
     
  7. Jan 1, 2016 #6
    Yep, the project - if I am able to get it working well, otherwise it will be just for fun - will be for a programming course I am taking this coming semester (it counts as 30% of the course grade), so as long as it fits their requirements it could be any subject. I thought it would be good practice though, because the forms of the laws are based on Newton's Laws of Gravitation, and the guy who came up with these relations was an astrophysicist. I plan to go into a computational physics field when I go to graduate school, probably in astrophysics, so I wanted my project to be somewhat relevant, but not strictly so.
     
  8. Jan 1, 2016 #7

    Mark44

    Staff: Mentor

    I'm with phyzguy as well, on the suitability of Python for your project. You can get a prototype up and running pretty quickly, and then, if needed, you can code the bits that need to run faster in C or C++.

    That's easy for me to say, as I have only been working with Python a few months, and haven't done anything with mixing Python and C code. The Python documentation talks about this, I believe, so that would be a good place to start.
     
  9. Jan 2, 2016 #8
    If you want to calculate the force between every pair of dots you'd have to solve the equation about n^2 times. So with 10,000 dots you'd need 100,000,000 calculations per simulation step which your processor is able to do in less than a second. Your graphics card however could do the same calculations 100 times faster. So if you manage to use opencl you can have 20,000 dots and still enough simulation steps per second for a smooth animation.
     
  10. Jan 2, 2016 #9

    FactChecker

    User Avatar
    Science Advisor
    Gold Member

    You might want to look at this problem in terms of simulating a set of difference / differential equations rather than tracking individual elements.
    PS. After more thought, this suggested approach may be as difficult as your original approach. It seems a lot like computational fluid dynamics, which also requires supercomputers.
     
    Last edited: Jan 2, 2016
  11. Jan 2, 2016 #10
    And the formulas may become invalid if we include physics. It seems the demographic gravitation is based on a symmetric migration in each direction but traveling in space or even from a planet into space and vice versa is highly asymmetric. This need to be included into the equations which requires assumptions about the technology. And it seems that all people are assumed to be equal (for large numbers of human beings) but living in micro gravity requires physical modifications which might result in an isolation of space populations and surface populations. This effect is very hard to estimate. However, this is a very interesting problem. I would be interested in the results for particular boundary conditions.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Would This be a Good Programming "Physics" Project?
Loading...