   n-body programming
  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 ?   
Quote:Original post by Great_WhiteHi 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.   ;  question is so clear what do you mean?   ;Quote:Original post by Great_Whitequestion is so clear what do you mean?Is there a context in there somewhere? I didn't see one :S   ;  "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.   ;  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"   