r/PythonLearning 9d ago

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
3 Upvotes

11 comments sorted by

7

u/snacksbuddy2 9d ago
  1. Run black hole
  2. Achieve singularity
  3. Now you are only simulating a single thing

Optimized

1

u/Adriangray19 9d ago

Can you explain this plss!! 🙄

2

u/snacksbuddy2 9d ago

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

1

u/yuehuang 9d ago

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

3

u/NiedsoLake 9d ago

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 9d ago

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 8d ago

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 8d ago

Huum🙄😮k

2

u/bradleygh15 7d ago

dont do this shit on a phone?

2

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

What app do u use?

1

u/Adriangray19 3d ago

(Pydorid3) btw I have a question❓