Intermediate Python Tutorial | Gravitational Slingshot Simulation

Intermediate Python Tutorial | Gravitational Slingshot Simulation

Tech With Tim

9 месяцев назад

31,275 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Gregory Buser
Gregory Buser - 04.11.2023 00:45

I LOVE the video, it’s probably one of the very best I’ve ever seen and I’ve watched thousands.
My physics is no better than my Python, but it seems to me like all the messing around with trigonometry was unnecessary: given the distance A with x, y components being the x and y distances, wouldnt the force vector A have x and y components in equal proportion to x and y distance? No solving for theta required?

Ответить
robin vermillion
robin vermillion - 30.10.2023 04:49

can you add a change in color to the object based on speed.. great video, that is the stage i need to advance to next.

Ответить
48_Subham Banerjee
48_Subham Banerjee - 28.10.2023 21:59

Amazinggg ☠️☠️💀💀. You sre python god

Ответить
Its gaming time with Asad
Its gaming time with Asad - 28.10.2023 20:53

How to add images in vscode ?
Pls help

Ответить
Ethan Hundiak
Ethan Hundiak - 27.10.2023 22:38

Hey tim, When i try to import sys on pycharm why wont it allow me to add it to the python interpreter?

Ответить
Schielke
Schielke - 26.10.2023 23:46

Very well made tutorial, im just starting out in python knowing only the basics and learned very much here, thank you!

Ответить
physicsninja
physicsninja - 24.10.2023 13:37

Get the initial velocity vector point toward earth's center and you're gonna get a blowup in finite time :-)

Ответить
ChupoCro
ChupoCro - 20.10.2023 02:54

As @johnnytoobad7785 already pointed out, this way of "summing apples and oranges" is without an additional explanation very confusing because units don't match. Adding velocity to the position or adding acceleration to the velocity is, of course, wrong but why that here works is because all units in this program are related to the frame rate. So instead of speed being [pixels/second] the speed is here in [pixels/frame_duration] and instead of acceleration being [pixels/s^2] the acceleration is here in [pixels/frame_duration^2]. The duration of one frame is, of course, related to time in seconds (1/FPS) and that's why in the end the program works. That kind of frame rate dependent movement was used on 8 bit computers back in the 80s when processing power was low (so you could use just integers) but there isn't a reason to use that mathematically incorrect way nowadays anymore when computers have more than enough processing power to calculate the simulation properly. My recommendation is to always use frame rate independent algorithms (accounting for delta t) and to always write the units next to the value to avoid the confusion. For example:

speed = 0 # [px/s]
acceleration = 0 # [px/s^2]
pos_x += speed_x*delta_t # [px/s * s = px]
speed_x += acc_x*delta_t # [px/s^2 * s = px/s]

That way it would be obvious adding pixels per second to pixels or adding pixels per seconds squared to pixels per seconds is not correct and besides the simulation would work the same at any frame rate. You don't really want to tie anything to the frame rate in the program you'd like to call simulation.

Ответить
Lee Paul
Lee Paul - 19.10.2023 22:33

Smart

Ответить
Tawana Chingarande
Tawana Chingarande - 19.10.2023 20:09

how does bro not know how to spell gravitational

Ответить
Fábio Henrique
Fábio Henrique - 19.10.2023 19:29

The video reminded me of Angry Birds Star Wars!

Ответить
faizi289
faizi289 - 18.10.2023 22:38

Please cover these django topics
how to enter multiple entries in database, signals,
How to use pagination, data table, jwt token and rest ful apis

Ответить
Pedro de Sá
Pedro de Sá - 18.10.2023 21:50

That was a great tutorial, and easier than I thought it would be.

Im working on a fork of the project, im trying to implement a path prediction for the object before the player clicks.

Ответить
Fudge Nuggets
Fudge Nuggets - 18.10.2023 04:29

These are my favorite videos. I would like to see more physics simulators. Maybe something that draws out lines of magnetism to get away from classical mechanics and delve into electrodynamics.

Ответить
Participant
Participant - 16.10.2023 23:07

Get some sunlight Tim.

Ответить
Julia Coggins
Julia Coggins - 16.10.2023 20:32

Hey Tim, very cool project. As a theoretical physics graduate, I really appreciate it!

Ответить
Jackson
Jackson - 16.10.2023 19:53

Dude this was perfect, Im loving the mix of physics in with coding lessons. Would be cool to see a build with multiple planets. Also these hourish long tutorials are the perfect length and skill level for me right now so thats super helpful.

Ответить
Johnny Toobad
Johnny Toobad - 16.10.2023 19:17

This is a great simulation project to see how objects work in "real time".
However I think there is some confusion in the last section.
Your are adding components of an acceleration vector to obtain a velocity vector and then sum the components of a velocity vector
to obtain a position vector. Every time you perform an "ADD" operation in "move" you essentially drop a physical dimension d/s2 -> d/s -> d.
So your essentially summing apples, oranges and pears.
I see it working... but those "vector" additions would fail a physics exam since all the vectors discussed have a different set of units.
Each "time slice" of the simulation changes only the relative x&y positions of the ship.

Ответить
Bubz Johnson
Bubz Johnson - 16.10.2023 18:17

Yo this is awesome I love science and coding and you merged both of my favorite subject in one video. Your awesome

Ответить
Jorge Escobar
Jorge Escobar - 16.10.2023 15:59

My favorite video so far🎉

Ответить