Jump to content

N-body problem: Difference between revisions

Corrected acceleration function.
(Updated console output)
(Corrected acceleration function.)
Line 378:
for(j=0;j<bodies;j++){
if(i!=j){
accelerations[i] = addVectors(accelerations[i],scaleVector(GravConstant*masses[ij]/pow(mod(subtractVectors(positions[i],positions[j])),3),subtractVectors(positions[j],positions[i])));
}
}
Line 429:
}
</lang>
 
===Further work===
And as in every experiment report/journal paper/whatever, time for some philosophizing, a more rigorous implementation will require the bodies to be realistic, this means they will not be point particles and hence the dynamics will be much more complex. Tidal effects, collisions, orbits will require much more computation. When I say realistic, I don't mean rigid bodies because even rigid bodies are an idealization of reality. And all of this, even with classical mechanics, employing the Newtonian version of Gravitation will be a worthy task for any competent Physicist, let alone a Programmer. Introduce the General Theory of Relativity and everything changes. I can go on and on, but this is a coding, not a rambling site. I will end by saying that the Inverse Square Law, a name often used for Newtonian Gravitation, is just one class of forces studied in Dynamics. The force relation can take any form, the N-body problem can therefore be solved in (countably/uncountably ?) infinite ways.
503

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.