Best Environment/Programming Language for simple physics Simulations

AI Thread Summary
The discussion centers around finding suitable software and programming languages for simulating and visualizing classical physics and engineering mechanics. Key requirements include the ability to visualize geometric representations, animate simple physics scenarios like bouncing balls and projectile motion, and perform basic static simulations. Python emerges as the preferred option due to its simplicity and the availability of numerous tutorials and packages. Mathematica is suggested as a superior paid alternative to Matlab for its symbolic capabilities, while Physlets, a JavaScript-based tool, is recommended for its ease of use and extensive library of applets for educational purposes. Open Source Physics in Java is highlighted for its comprehensive examples and compatibility with users familiar with C++. Julia is also mentioned as a strong alternative, combining a user-friendly syntax with robust mathematical functionality, and is recommended for those seeking a free alternative to Matlab. Additionally, Octave is noted as a free option similar to Matlab, and Jupyter notebooks are suggested for their versatility in coding and simulation.
Jarfi
Messages
384
Reaction score
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
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
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
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
 
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.
 
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.
 
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.
 
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
Back
Top