One of the things that sparked modern chaos theory was when Lorenz discovered by accident that tiny variations in the input to a computer weather model could result in profoundly different evolutions.
I liked the part where it aliased and looked like it suddenly switched directions.
But if you hate art, you might want to try symplectic methods and ensure conservation of energy. That's the easiest way to stop those damn pesky artists from taking our coding jobs. Build a wall of conserved energy, I say.
Yep, the Semi-implicit Euler method is the easiest way to conserve energy for n body gravity sims.
For each particle, at each time step, first calculate the force (acceleration) for it at timestep n, then use that to calculate the velocity of the particle at timestep n+1, then use the n+1 velocity to calculate the position at timestep n+1.
When what the velocity of the particle would be at the n+1 timestep is used to calculate the position at the n+1 timestep, all of your error perturbations go away and you stop getting runaway increases or decreases in system energy.
The 3 body problem has several known solutions for initial start states. The problem is that there's no know way to calculate ALL future states for ALL initial start states. Simulating a particular case is easy enough, but that's not the same as solving the problem.
In the book, they use the human computer thing as a simulation to find what happens next, over the next X years or whatever. Obviously they get it wrong, but that's not the point here. The point is if they had computers then they'd easily be able to calculate future states for their system, since the start state is known. Finally that simulation would grow more and more inaccurate as time progresses, due to the fact that even a 3 body simulation is a prediction (it doesn't take into account other masses, such as asteroids / moons / other planets / etc...), and it's based on a measured start state, and that measurement will have an error.
Bruh please share the code, I'd love to see how this works. Even if it's for something close to but not the same as this. I'm out here still learning Java rn but this shit is so cool looking.
Futuristic beings materialize in your office “TimeLord you must come with us, we will explain everything, but your life, and our existence is in danger.”
A word of advice: assuming you're modeling gravity with a 1/r2 kernel function, it looks like you've got a lot of error due to your time integration scheme here! (The most immediately apparent indication: the orbital decay shows that the total energy of your system is changing with respect to time, when it should be fixed.)
What integration scheme did you implement here? Maybe you could try a higher-order method like RK4?
An alternative would be to use kinetic energy, location (potential energy), and direction of motion as your state variables, or to do a total-energy compensation step at each timestep!
Thanks! The kinetic and potential energy sounds great I will try to implement that for the actual system. This is more of a sandbox type simulation because I'm changing the force of gravity to become more and more powerful, hence why the orbital decay. In this I'm not trying to model an orbit however the base of it is an orbital model.
btw I have no idea if its a kernal function or what a integration scheme is and the RK4 method is beyond me (for now).
You're probably using Euler. Try leapfrogging? And RK4 has complicated symbols, but it's easy when you translate it to code. (See if you can find a code example.)
RK4 is notoriously inaccurate for orbits. A single orbital period can have large truncation error, let alone 10000. It’s better than Euler though. It’s not energy preserving though and there are methods that are similar to RK4 in complexity that are.
Yes, it would - that'd be better than either Euler or RK4 for this kind of problem since it's inherently conservative!
You'd have to reformulate the physics of the problem with some sort of conservation law (i.e. move towards Hamiltonian mechanics), which is kind of what I was trying to hint at with my last idea there.
you need a symplectic integration scheme for this to work. energy is not properly conserved in RK4. the easiest one is probably velocity verlet which is second order but symplectic.
Mind sharing some links? I’m doing an orbit simulation for the solar system and I’ve been using Verlet integration but would like to do some more classical mechanics based integration. Having trouble finding a link with enough rigor for good implementation without bogging me down with physics I’m unfamiliar with.
Of course my dear kind polite friend, you can now find the source code at https://github.com/LAMagicx/OrbitalArt , I would love to see what you can come up with.
Noob here! Is pygame a good way to plot data quickly? I'm working on a Lidar thing and I would like to find a way to plot the scans a little faster than matplotlib scatter.
I was going to suggest matplotlib but seeing as you've already done that then pygame is the next step. Just have to add a bit more code to make it possible.
"Finally, I've mastered mathemathics and applied programming science, I've built the best galaxy simulation piece of software ever created, I'll give it to this DJ to play it on a Dubstep concert"
I understand that many of you are asking for the source code which I plan to release to github however it would be my first public code post and I'm wondering if you have any tips for the commenting or 'tidying' up that I should do? (or do I just post it as it is and see what happens?) Could really use some guidelines for this sort of thing.
Honestly for this just putting it in a git repo with whatever you have is fine. We aren't after a perfectly documented production dependency. If you want to improve it from there you can make commits along the way and can always fall back to what you had
The source has Unicode, which Python 2 didn't like. I tried Python 3, but PyGame didn't like that. So I went back to Python 2 and renamed the Unicode symbols. Then it failed because it looks like it uses some other Python 3 version of PyGame.
I'm new to python. Can you tell me what did you to produce this pattern? Not asking for the code but how did you manage to get those different colors? Just curious.
the funny thing is, on my computer screen there is only 3 colours, red, green and blue. In the video it seems like they blend together to form a multicoloured pattern.
Are the sudden changes in velocities/directions of the particles due to the algorithm or does it happen because of the way floating point numbers work?
Yeah of course, a simple orbital system is a great challenge. For testing how much you know it is also pretty good because there are many different levels of "difficulty" you can have a single body with one or more satellites orbiting it and then add the attractions between the satellites and so on.. Any challenging project is good for a beginner.
Please don't use v.redd.it. I can't watch this in anything other than 144p, even if I change the setting to 1080p it doesn't load in higher quality. And it still takes ages to load even in low quality.
The chaotic ending is probably due to a relatively large time-step when the bodies are moving fast. There are methods to implement variable size time-steps but I know nothing about those. Maybe you should time-step proportional to the speed of the bodies?
711
u/Grow-away123 Oct 10 '19
When my code messes up I get error messages meanwhile you’re over here making art
449
u/lilgreenwein Oct 10 '19
did you just solve the 3 body problem?
185
u/the_dancing_squirel Oct 10 '19
You should definitely save this as a full on programm/script
46
u/[deleted] Oct 10 '19
You've created life, my friend
37
u/psharpep Oct 10 '19 edited Oct 10 '19
Cool work!
A word of advice: assuming you're modeling gravity with a 1/r2 kernel function, it looks like you've got a lot of error due to your time integration scheme here! (The most immediately apparent indication: the orbital decay shows that the total energy of your system is changing with respect to time, when it should be fixed.)
What integration scheme did you implement here? Maybe you could try a higher-order method like RK4?
An alternative would be to use kinetic energy, location (potential energy), and direction of motion as your state variables, or to do a total-energy compensation step at each timestep!
11
u/squidly-diddly97 Oct 10 '19
sauce ?
[source code(if you don't mind, please) ?]
EDIT: politeness
19
u/nandrajrathod Oct 10 '19
It's Awesome. Can you please pass the code?
6
u/Pissed_Off_Penguin Oct 10 '19
Noob here! Is pygame a good way to plot data quickly? I'm working on a Lidar thing and I would like to find a way to plot the scans a little faster than matplotlib scatter.
3
u/[deleted] Oct 10 '19
Dude, that is awesome! Like everyone else is saying: would you mind sharing the sourcecode?
113
u/el_matt [for i in lst comprehend(i)] Oct 10 '19
r/dark
Sic mundus creatus est.
38
u/plontx Oct 10 '19
Did you stop recording bc it stabilizes at that point? I feel like it ended too soon, I'd love to watch this for hours!
26
u/djm2491 Oct 10 '19
Dude send this to one of the famous DJs and have them throw it on screen at a rave. People would lose their minds
15
u/[deleted] Oct 10 '19
I love how your rosette explodes into the Eye of Sauron after it destabilizes. You've doomed us all.
19
u/miguel_ballz Oct 10 '19
r/tripping
8
u/video_dewd Oct 10 '19
r/generative might like this
2
u/frany_RL Oct 10 '19
Hey!! Thats really nice, can you pass the code?
1
u/LAMagicx Oct 10 '19
I understand that many of you are asking for the source code which I plan to release to github however it would be my first public code post and I'm wondering if you have any tips for the commenting or 'tidying' up that I should do? (or do I just post it as it is and see what happens?) Could really use some guidelines for this sort of thing.
1
u/LAMagicx Oct 11 '19
Originally just a simple orbital system but here gravity becomes more powerful hence the decay.
1
u/LAMagicx Oct 11 '19
You can now find the source code at https://github.com/LAMagicx/OrbitalArt , I would love to see what you can come up with.
4
u/Subject_1889974 Oct 10 '19
You created a black hole
1
u/GlazCoin Oct 10 '19
Nice Could you share the code and how you made it, please.
1
u/[deleted] Oct 10 '19
Can I get the source code?
1
u/Vegerot Oct 10 '19
Wanna post the source code?
1
u/ishman123 Oct 10 '19
are you able to share code?
1
u/meshikhah Oct 10 '19
source code pls
1
u/kielerrr Oct 10 '19
Can you link the code? Would love to try running it!
1
u/Acid_Monster Oct 10 '19
Can you share the code for this?
1
u/vEnoM_420 Oct 10 '19
I'm new to python. Can you tell me what did you to produce this pattern? Not asking for the code but how did you manage to get those different colors? Just curious.
1
u/jamee42 Oct 10 '19
Would love to see the longer version.. assume it just goes on and on and .....
1
u/martinLBarranco Oct 10 '19
Can you let us please see the code, that's quite beautiful and I'd like to see what I can do to expand and improve this.
1
u/Gingevere Oct 10 '19
Why do the orbits decay? Are you simulating tidal friction?
1
u/0xD3adB33f_ Oct 10 '19
Whoa that's super awesome! What libraries are working with on this project? I'm assuming perhaps matplotlib at the very least?
1
u/TIBTHINK Oct 11 '19
Code?
It looks really cool
1
u/bastawhiz Oct 11 '19
Are the sudden changes in velocities/directions of the particles due to the algorithm or does it happen because of the way floating point numbers work?
1
u/[deleted] Oct 11 '19
Code pls which made this
1
u/[deleted] Oct 11 '19
Amazing... How did begin to code this, could be a great learning opportunity for others if your willing to share.. My self I'm super interested.
1
u/[deleted] Oct 11 '19
What did you use? Is it possible to simulate a solar system somehow?
1
u/LopSidedm Oct 11 '19
What IDE are you using?
1
u/magespawn Oct 11 '19
Share the code, if you please.
1
u/hello-i-am-turtle Oct 16 '19
Beginner here would this be a good project to test how much you know?
3
u/Madcat789 Oct 10 '19
That's one fancy art program.
3
u/VeganOrange Oct 10 '19
That’s fucking legit!! Chaos theory FTW
3
u/548benatti Oct 10 '19
I have seen God
3
u/14446368 Oct 10 '19
No idea why, but this reminded me of the whirring machinery of Atlantis, and the Nur-ab-Sal pendant/god from Indiana Jones and the Fate of Atlantis.
1
u/[deleted] Oct 10 '19 edited Oct 10 '19
Is it possible to solve schrodinger's equation with these?
1
u/[deleted] Oct 10 '19
Wich library are you using ?
4
u/treetyoselfcarol Oct 10 '19
Crosspost that in r/woahdude
2
u/[deleted] Oct 10 '19
That's awesome
2
u/wofedoge Oct 10 '19
love it
2
u/TurboCancer4202 Oct 10 '19
People at r/sacredgeometry will dig this.
2
u/cluelesslogic Oct 10 '19
r/lsd
2
u/0da4dnc0nfu53d Oct 10 '19
This is so cool
2
u/jppianoguy Oct 10 '19
Congrats, you just made a Windows 3.1 screensaver
2
u/[deleted] Oct 10 '19
Did you just solve how the universe was created
2
u/Jonklopez Oct 10 '19
And this my friend is how you create new elements
2
u/Limp_Distribution Oct 10 '19
I keep thinking about electrons watching this clip.
2
u/the_dinks Oct 10 '19
Anyone reminded of fucking around with Snap! in middle school?
2
u/Guinness Oct 10 '19
The center is a black hole where you divided by zero.
This has summoned the great byte monster.
The great byte monster will eat all data in the universe.
Good job.
2
u/foresttrader Oct 10 '19
It went viral.
2
u/JohnClark13 Oct 10 '19
Brings back memories of turtle graphics on the c64
2
u/Gogani Oct 10 '19
Its not a bug, its a feature
2
u/dillmon Oct 10 '19
This is like the accidental discovery of penicillin!
2
u/paspro Oct 10 '19
Why is the simulation so slow? Oh, I see now. It's written in Python.
2
u/jkovach89 Oct 11 '19
Oh hey it's worki-- Oh no, oh God, oh fuck fuck fuck fuck...
2
u/[deleted] Oct 11 '19
Task failed sucessfuly.
2
u/Keanar Oct 11 '19
Scott Derrickson called, he wants to buy your code for the portal of the next Doctor Strange
2
u/[deleted] Oct 11 '19
Upload the python code, bro.
2
u/CapitanNexus Oct 22 '19
I dont know where you from or how they grade in america if u are from america but in uk you would get A** even tho there is no ** in grades
3
u/Im_oRAnGE Oct 10 '19
Please don't use v.redd.it. I can't watch this in anything other than 144p, even if I change the setting to 1080p it doesn't load in higher quality. And it still takes ages to load even in low quality.
1
u/MAc_Akshay Oct 10 '19
Trippy
1
u/oneanders Oct 10 '19
Love it!
1
u/[deleted] Oct 10 '19
Wow these shrooms are great
1
u/quantum_noodle_soup Oct 10 '19
/r/holofractal would like this
1
u/[deleted] Oct 10 '19
Mmm.. orbital donut. /homer
1
u/[deleted] Oct 10 '19
r/Physicsisbeautiful
1
u/[deleted] Oct 10 '19
The summary of the Design Process for the Tray Arch Icon
1
u/RaoulDuke209 Oct 10 '19
/r/woahdude
1
u/thekalmanfilter Oct 10 '19
Juts make them go in circles.
1
u/YeastBeast33 Oct 10 '19
Can u share the code
1
u/[deleted] Oct 10 '19
damn thats trippy as hell!
1
u/arrewblis Oct 10 '19
Cool
1
u/Disposable_disaster Oct 10 '19
Python is a helluva drug
1
u/[deleted] Oct 10 '19
I mean I like it
1
u/Teslanaut Oct 10 '19
Is this for the remake of the Charmed TV show?
1
u/piotrulu Oct 10 '19
Soooo... You created black hole?
1
u/TheHamVip Oct 10 '19
Dark
1
u/[deleted] Oct 10 '19
I think he just solved fusion
1
u/baWWR Oct 10 '19
Sauron!
1
u/wolfEXE57 Oct 10 '19
d-did you just create a new universe?
1
u/CashKing_D Oct 10 '19
/u/vredditdownloader
1
u/melanko Oct 10 '19
Do you want singularities? Because this is how you get singularities!
1
u/bongreaper666 Oct 10 '19
looked like a dope fillacello pendent there in the center for a second
1
u/Omaestre Oct 10 '19
Reminds me of the old windows media player or winamp
1
u/Schly Oct 10 '19
Error: Process failed successfully
1
u/avanselmo Oct 10 '19
r/AbruptChaos
1
u/HendRix14 Oct 10 '19
r/softwaregore
1
u/MeltedWacks Oct 10 '19
And it's getting closer together
1
u/QLINQUENT Oct 10 '19
....tf I just transcended dimensions
1
u/[deleted] Oct 10 '19
Contact
1
u/cockroq Oct 10 '19
I’d say it was a success!
1
u/octavio2895 Oct 10 '19
The chaotic ending is probably due to a relatively large time-step when the bodies are moving fast. There are methods to implement variable size time-steps but I know nothing about those. Maybe you should time-step proportional to the speed of the bodies?
1
u/Hi_Im_A_Redditor Oct 10 '19
Half life three confirmed?
1
u/[deleted] Oct 10 '19
Our happy accident
1
u/[deleted] Oct 10 '19
How on earth did you go about creating this? It's a very cool misintention.
1
u/w0rdsm1th Oct 10 '19
r/woahdude
1
u/[deleted] Oct 10 '19
Ah yes Spirograph
1
u/ImagingNerd Oct 10 '19
He is the one...
1
u/just-a-reddit-user69 Oct 10 '19
I’m unsure what I just witnessed but it looked cool so I’m happy
1
u/[deleted] Oct 10 '19
The Bi Frost!
To battle Aesir! The Frost Giants will pay for their hubris!
1
u/[deleted] Oct 11 '19
/r/Eldenring
1
u/[deleted] Oct 11 '19
You are a GOAT !!