Would This be a Good Programming "Physics" Project?

• stefan10
In summary, the conversation discusses a project that the speaker wants to work on, which involves using Python and potentially C or C++ to create a 3D visualization of population centers and their movement patterns using demographic laws. The speaker believes that this is within the capabilities of a personal computer and is excited to use the project as practice for their future career in computational physics. They also mention the term "social physics" which is a combination of sociology and mathematical principles, and the project may not necessarily be focused on physics.
stefan10
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?

The following are some of the key equations (with plain English paraphrases) from his article in sociometry:

(Demographic Force = (population 1 multiplied by population 2) divided by (distance squared))

(Demographic Energy = (population 1, multiplied by population 2) divided by distance; this is also Zipf's determinant)

(Demographic Potential of population at point 1 = population at point 2, divided by distance)

(Demographic Potential in general = population divided by distance, in persons per mile)

(Demographic Gradient = persons per (i.e. divided by) square mile)

Last edited:
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.

stefan10
Interesting perhaps, but not really physics.

stefan10
phyzguy said:
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.

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.

Dr. Courtney said:
Interesting perhaps, but not really physics.

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.

Dr. Courtney said:
Interesting perhaps, but not really physics.
stefan10 said:
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.
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.

stefan10
Mark44 said:
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.
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.

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.

stefan10
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.

stefan10
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:
stefan10
Dr. Courtney said:
Interesting perhaps, but not really physics.

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.

1. What is the purpose of a "Physics" programming project?

The purpose of a "Physics" programming project is to use computer programming to simulate physical systems or phenomena, analyze data, and solve complex problems in the field of physics.

2. What are some examples of "Physics" programming projects?

Some examples of "Physics" programming projects include creating simulations of planetary motion, modeling fluid dynamics, or developing algorithms to solve equations in quantum mechanics.

3. Do I need to have a background in physics to work on a "Physics" programming project?

While having a background in physics can be helpful, it is not necessary to have prior knowledge of physics to work on a "Physics" programming project. However, a strong understanding of mathematical concepts and programming skills are essential.

4. What programming languages are commonly used in "Physics" projects?

Commonly used programming languages in "Physics" projects include Python, C++, Java, and MATLAB. The choice of language depends on the specific project and its requirements.

5. What skills do I need to have to successfully complete a "Physics" programming project?

To successfully complete a "Physics" programming project, you will need to have a strong understanding of physics concepts, good problem-solving skills, and proficiency in programming languages and data analysis tools. Additionally, being able to work independently and collaborate with others is important for a successful project.

• Programming and Computer Science
Replies
16
Views
2K
• Programming and Computer Science
Replies
1
Views
654
• Programming and Computer Science
Replies
10
Views
1K
• Programming and Computer Science
Replies
8
Views
1K
• Programming and Computer Science
Replies
5
Views
1K
• Programming and Computer Science
Replies
1
Views
805
• Programming and Computer Science
Replies
22
Views
9K
• Programming and Computer Science
Replies
6
Views
1K
• Programming and Computer Science
Replies
10
Views
1K
• Programming and Computer Science
Replies
9
Views
1K