By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,100 Members | 2,846 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,100 IT Pros & Developers. It's quick & easy.

How to append array:mass=2e30*N.ones((100,1)) to have 3 more bodies with mass 2e32?

P: 1
I'm pretty new to this but i am making a program to simulate gravitationally interacting bodies. So i have 100 bodies all the same mass and i want to append it so that i have 100 bodies all the same mass and 3 bodies with 100xthe original mass i f you catch my drift? (they are to simulate dense regions such as black holes). my original code looks like this:


and i want the new array to be 103 masses with 3 of them with mass 2e32! how do id this?

Jan 15 '11 #1
Share this Question
Share on Google+
1 Reply

Expert 100+
P: 624
You do not assign the same values to 100 different variables. You use the same variable 100 times, usually in a loop. And the same for the larger mass. Assign the larger mass to one variable and use it however many times you wish. Without any code posted there is no way to tell what you are trying to do, so no more can be said.
Jan 15 '11 #2

Post your reply

Sign in to post your reply or Sign up for a free account.