Best Environment/Programming Language for simple physics Simulations

In summary, the best environment and programming language for simple physics simulations would depend on the specific needs and goals of the project. For beginners, a user-friendly and versatile environment like Unity or Unreal Engine, along with a programming language such as C# or Python, would be ideal. For more advanced users or those requiring high performance, a more specialized environment like MATLAB or Octave, with a programming language like Fortran or C++, may be more suitable. Ultimately, the choice should be based on the level of complexity and accuracy required for the simulations, as well as the user's proficiency with the chosen tools.
  • #1
Jarfi
384
12
TL;DR Summary
What is the best package to make visualizations and simulations of classical physics equations and particles
Hello, I am looking for something to simulate/visualize simple particles and classical physics equations, preferably moving in real time

Requirements:
-Able to turn matrices/functions into geometric representations(visualize sphere, visualize a cylinder etc.)
-Can do the classic ball bouncing between walls animation
-Can do a charged ball moving in an electric field
-Can do a cannon-ball falling in gravity, possibly with air resistance
-Possibly make simple statics simulations, f.ex. using beams with a certain elastic modulus and breaking point.

I am not looking to do super advanced plasma physics, I just want to be able to the visualize classical physics and engineering mechanics. I want to have the power of programming though, but I don't want to have to program everything from the ground up, such as the graphics packages and so on.

What I had thought of
R
C++
Python
Matlab(i don't really want to pay though)

What do you think is best, what packages or libraries do you recommend?
 
Technology news on Phys.org
  • #2
R is really focused on statistics.

C++ is pretty verbose, so you have to write a lot of lines of code to get something to work. Not ideal for prototyping.

Python would be good and will probably be the best option of those you have listed.

For paid software I would go with Mathematica over Matlab. The symbolics are much better and for physics that is important.
 
  • Like
Likes vanhees71
  • #3
About 20 years ago I started using Physlets. I had quite a ball with them creating simulations to use in my lectures as illustrations, online quizzes etc. I am sure they have improved since then although I have not done anything since I retired four years ago. The language is Javascript so it's quite easy to pick up and use. I used them in both semesters of intro physics and in intermediate mechanics.

I highly recommend that you take a look. They have a wonderful library of applets that are easy to implement. Your imagination is the limit.

Disclaimer: I know nothing about the current version, 3E; I have used 2E.
 
  • Like
Likes jedishrfu, vanhees71 and Dale
  • #4
kuruman said:
About 20 years ago I started using Physlets. I had quite a ball with them creating simulations to use in my lectures as illustrations, online quizzes etc. I am sure they have improved since then although I have not done anything since I retired four years ago. The language is Javascript so it's quite easy to pick up and use. I used them in both semesters of intro physics and in intermediate mechanics.

I highly recommend that you take a look. They have a wonderful library of applets that are easy to implement. Your imagination is the limit.

Disclaimer: I know nothing about the current version, 3E; I have used 2E.
I have to say coming from a C++ background I am not a huge fan of javascript, but thanks for the suggestion
 
  • #5
Dale said:
R is really focused on statistics.

C++ is pretty verbose, so you have to write a lot of lines of code to get something to work. Not ideal for prototyping.

Python would be good and will probably be the best option of those you have listed.

For paid software I would go with Mathematica over Matlab. The symbolics are much better and for physics that is important.
Yes I guess python is where it's at, I saw a lot of tutorials and packages that may be helpful

As for R, it is statistics oriented but you'd be surprised by how much it can do, I have believe it or not managed to visualize a wave function moving in time using a simple plot-refresh function.
 
  • #7
Jarfi said:
Yes I guess python is where it's at, I saw a lot of tutorials and packages that may be helpful

As for R, it is statistics oriented but you'd be surprised by how much it can do, I have believe it or not managed to visualize a wave function moving in time using a simple plot-refresh function.
There is also Julia, which combines a simple python-like syntax, with the mathematical functionality of R/Matlab.
 
  • #8
Yes, Julia is a good choice although Open Source Physics has a book and extensive examples to follow and its closer to the OP's experience with C++.

I like Julia a lot, there's a book called Algorithms for Optimization that came out recently with all examples in Julia:

https://www.amazon.com/dp/0262039427/?tag=pfamazon01-20

and for folks looking for a good alternative to Matlab sans the IDE and associated costs of ownership, Julia is the one to choose.
 
  • #9
jedishrfu said:
and for folks looking for a good alternative to Matlab sans the IDE and associated costs of ownership, Julia is the one to choose.
JuliaPro (Juno IDE) is a free IDE for Julia, similar to RStudio:
https://juliacomputing.com/products/juliapro
 
  • #10
That is true but they are no match for the Matlab ide honed over many years of use.

Personally I like the Jupyter notebooks and console web based IDE.
 
  • #11
Octave ( similar to Matlab ) is wonderful... and free.
 
  • Like
Likes jedishrfu

1. What are the most commonly used programming languages for simple physics simulations?

The most commonly used programming languages for simple physics simulations are Python, Java, and C++. These languages are popular because they are versatile, have a large community of users, and have libraries and packages specifically designed for scientific simulations.

2. Which programming language is best for beginners to use for simple physics simulations?

Python is considered the best programming language for beginners to use for simple physics simulations. It has a simple and easy-to-learn syntax, and there are many online resources and tutorials available to help beginners get started.

3. Are there any specific features or libraries to look for in a programming language for simple physics simulations?

When choosing a programming language for simple physics simulations, it is important to look for libraries or packages that have built-in functions for mathematical calculations, visualization, and handling large datasets. Some examples include numpy, matplotlib, and scipy for Python, and the Standard Template Library for C++.

4. Can I use any programming language for simple physics simulations, or are there limitations?

While you can technically use any programming language for simple physics simulations, some languages may have limitations or may not be as efficient as others. For example, languages with less built-in mathematical functions or slower execution times may not be as suitable for complex simulations.

5. How do I determine which programming language is best for my specific physics simulation project?

The best way to determine which programming language is best for your specific physics simulation project is to consider the specific requirements and goals of your project, as well as your personal experience and familiarity with different languages. It may also be helpful to consult with other scientists or researchers in your field for their recommendations and experiences with different languages.

Similar threads

  • Programming and Computer Science
Replies
3
Views
1K
  • Programming and Computer Science
Replies
1
Views
1K
  • Programming and Computer Science
Replies
1
Views
1K
  • Programming and Computer Science
Replies
15
Views
1K
  • Programming and Computer Science
Replies
4
Views
1K
  • Programming and Computer Science
2
Replies
54
Views
3K
  • Programming and Computer Science
Replies
8
Views
877
  • Programming and Computer Science
Replies
11
Views
1K
  • Programming and Computer Science
Replies
3
Views
4K
  • STEM Career Guidance
Replies
22
Views
3K
Back
Top