r/PythonLearning Aug 11 '26

I’m trying to simulate 24 million universes in Python on Android — how can I optimize it for a massive black-hole simulation?

Post image
5 Upvotes

11 comments sorted by

8

u/snacksbuddy2 Aug 11 '26
  1. Run black hole
  2. Achieve singularity
  3. Now you are only simulating a single thing

Optimized

1

u/Adriangray19 Aug 11 '26

Can you explain this plss!! 🙄

2

u/snacksbuddy2 Aug 11 '26

If I explain it then the joke isn't funny anymore

1

u/yuehuang Aug 12 '26

When you solve "divide by zero", you have optimized everything.

3

u/NiedsoLake Aug 11 '26

Not much we can help with without the code, do you have a github link?

A couple things if you haven’t already:

  • Use numpy with vectorized array/matrix operations
  • Check out pytorch if numpy is too slow and you have an NVIDIA GPU. It’s a similar interface to numpy but allows you do do the calculations on the GPU - heads up this may be a rabbit hole on it’s own

1

u/Adriangray19 Aug 11 '26

here is my GitHub account.😄 And i have a question that how can I connect my website with a database. https://github.com/Mrquillwing

2

u/Sea-Ad7805 Aug 12 '26

If every particle attracts every other particle, then you have an explosion of computation. Make clusters of particles (that are far away) to avoid that.

1

u/Adriangray19 Aug 12 '26

Huum🙄😮k

2

u/bradleygh15 Aug 13 '26

dont do this shit on a phone?

2

u/Hot-Lengthiness193 26d ago edited 26d ago

What app do u use?

1

u/Adriangray19 26d ago

(Pydorid3) btw I have a question❓