Hacker News new | ask | show | jobs
by at_a_remove 907 days ago
You focused on just one clause. Consider the whole:

1) Three dimensions, not two. Therefore distance is not the square root of (delta-x * delta-x + delta-y * delta-y) but the cube root of (delta-x * delta-x + delta-y * delta-y + delta-z * delta-z). More operations.

2) Three dimensions, not two. As you start increasing the number of dimensions, the simulation feels more and more empty. One hundred particles on a line a thousand units long is crowded. One hundred particles on a grid of one thousand by one thousand feels like more "room" for that same number of particles. In a volume of a thousand by a thousand by a thousand, one hundred particles feels too few, and one would naturally increase the number of particles. Naively, which is to say without optimizations, the number of force computed grow as N-squared. More operations.

3) Cube falloff goes by r * r * r, rather than r * r. More operations, by fifty percent. And I did suggest some more exotic functions in there which certainly could be more daunting.

1 comments

> 1) Three dimensions, not two. Therefore distance is not the square root of (...) but the cube root of (...).

No, it is still a square root. The term under the root is correct, but distance in N dimensions (assuming euclidian space) is just sqrt(sum(delta-n ^ 2))

Hah, you're right. Serves me for typing late at night.