n-body programming

Started by
4 comments, last by Will-O 14 years, 11 months ago
Hi all, I'm wondering what values I should choose for initial values of the bodies' positions, velocities and their masses. So far I'm only using drand48() func. to initialize them in the range [-1,1] except masses. Any other alternatives you recommend ?
"A human being is a part of a whole, called by us,universe, a part limited in time and space. He experiences himself, his thoughts and feelings as something separated from the rest... a kind of optical delusion of his consciousness. This delusion is a kind of prison for us, restricting us to our personal desires and to affection for a few persons nearest to us. Our task must be to free ourselves from this prison by widening our circle of compassion to embrace all living creatures and the whole of nature in its beauty."A. Einstein
Advertisement
Quote:Original post by Great_White
Hi all,

I'm wondering what values I should choose for initial values of the bodies' positions, velocities and their masses. So far I'm only using drand48() func. to initialize them in the range [-1,1] except masses. Any other alternatives you recommend ?


I feel like I walked into the middle of a conversation with somebody else. Good answers require good questions.
We''re sorry, but you don''t have the clearance to read this post. Please exit your browser at this time. (Code 23)
question is so clear what do you mean?
"A human being is a part of a whole, called by us,universe, a part limited in time and space. He experiences himself, his thoughts and feelings as something separated from the rest... a kind of optical delusion of his consciousness. This delusion is a kind of prison for us, restricting us to our personal desires and to affection for a few persons nearest to us. Our task must be to free ourselves from this prison by widening our circle of compassion to embrace all living creatures and the whole of nature in its beauty."A. Einstein
Quote:Original post by Great_White
question is so clear what do you mean?


Is there a context in there somewhere? I didn't see one :S
clb: At the end of 2012, the positions of jupiter, saturn, mercury, and deimos are aligned so as to cause a denormalized flush-to-zero bug when computing earth's gravitational force, slinging it to the sun.
"n-body programming" is not a discipline, nor is it clearly indicative of what your are trying to accomplish. Although I will give you that it is clear that what you are trying to accomplish involves one or more thing.

Are we talking about planets? Particles? Complex rigid bodies attached by springs?

What forces, if any, are involved? Gravity? Friction? Strong nuclear force?

In the range of [-1,1] miles? Angstroms? AU?

Do you randomize each component or is do you randomize vector magnitude and then orientation?

What are you asking about alternatives to? Do you want an opinion on whether drand48() is suitable to whatever task you may have at hand? Are you asking whether the way you assign the random value is appropriate? Is your distribution not what you expected? Are you afraid that your method is inefficient? Are you asking whether you should randomize temperature as well? Are you asking whether your entire approach is flawed, or whether you should seek a more meaningful way to spend time with your dad?

Your question lacks any context whatsoever.

First, what are you trying to accomplish?
Second, how do you intend to accomplish it?
Third, what part of your method are you asking for alternatives to?
Fourth, what metric are you using to determine what is or is not a better method?

For instance: I'm trying to randomly generate a solar system, and so far I'm just randomizing every variable I have. This leads to a square and unstable distribution. Is there a way I can create a more natural looking solar system?

Then I might respond "Well, you have to understand that the velocity is dependent on the position in orbit, and also you may want to consider a variation of the Titius-Bode law to figure out where those initial positions may be."

You ask a good question, and I'll provide a good answer. That's how it works.
We''re sorry, but you don''t have the clearance to read this post. Please exit your browser at this time. (Code 23)
What isn't clear is what you are asking. Are there any alternatives to what: initial values (and your chosen range) or randomisation functions?

Are you seeking suggestions for alternative means of achieving a randomised number? If so then there are plenty. What it depends on is the way you wish the results to be spread.

Are you applying random values as scalars to distort an existing function (or data-set), which might introduce some noise?
- You might have a set number of objects which would normally be arranged in linear way, say one object every ten spatial units but that looks a bit staid so you might add a random function to vary the spacing.

Do you want the results to be focused in a particular part of your randomisation ranges?
- If you have some linear data so you actually want it randomised and skewed as well.

I don't use rand functions that much (except for img noise) because I'm usually trying to remove randomisations!

...sorry not be of more help. Post again if you were asking about something to do with the other part of the question "bodies' positions, velocities and masses"

This topic is closed to new replies.

Advertisement