Normal distribution and star density in a Galaxy

corndog16
Messages
1
Reaction score
0
Hey all.

I'm working on a personal programming project where I'm attempting to simulate (to a small degree) a galaxy. And I have come across a decent 2D density map for a spiral galaxy. This map (array actually) defines a 128x128 grid of values between 0 and 255 representing the frequency of stars found in that 'sector' of space.

I want to expand this density map into the 3rd dimension and I figure a good way to do that would be to define the height of the galaxy as being n sectors tall and then use a normal distribution curve to distribute the density value (something between 0 and 255) vertically across those 5 sectors.

My question is, how would I take a number, say 234, and divide it among n 'boxes' or 'sectors' so that it has a normal curve type distribution?
I attempted to Google this, but I found that what was coming up did not describe what I was looking for so I'm thinking that I don't currently have the vocabulary to describe this particular intent.
 
Mathematics news on Phys.org
corndog16 said:
My question is, how would I take a number, say 234, and divide it among n 'boxes' or 'sectors' so that it has a normal curve type distribution?

A normal distribution has two parameters, the mean \mu and the standard deviation \sigma. Let's say we have 128 boxes. Imagine the boxes as spaces between a ruler that has marks at 0,1,2,..128. Assuming you want the middle of the distribution to be at the middle of the ruler, set \mu = 64.

Then you have to decide on a value for \sigma. A normal distribution has non-zero values from - \infty to +\infty, so you have to decide what part of the distribution you are going to leave out or you have to settle for a distribution that doesn't exactly match a normal distribution by forcing all of the stars to be within the 128 boxes.

For most programming languages, you can find a library with a function that give the values of the cumulative normal distibution. Let's assume that such a function is

F(\mu,\sigma,x) = \int_{-\infty}^x f(\mu,\sigma,x) dx where f(\mu,\sigma,x) is the density of a normal distribution.

The fraction of stars between marks A and B on the ruler is

F(64,\sigma,B) - F(64,\sigma,A).

So the fraction of stars between the 0 and 128 marks is

M = F(64,\sigma,128) - F(64,\sigma,0)

The fraction that are outside those marks is 1 - M.

The fraction of stars in the kth box is s_k = F(64,\sigma,k) - F(64,\sigma,k-1). If you want to "renormalize" so that all the stars fall in the marks between 0 and 128, you can make the fraction of stars in the kth box \frac{s_k}{1-M}

For 234 total stars, the number of stars in the kth box will be (s_k)(234). So it won't always be a whole number. To convert to a while number, you'll have to decide how to round things off. (If you want the grand total to remain 234, you'll have to round off in a special way!)

The above calculations don't determine a unique value for \sigma. You'll have to try various values to find one that you like if your goal is only to have a pleasing picture. If you are doing a physical simulation of moving stars, we'll have to investigate the problem further.
 
Hi,
Any chance you could post your source for the 2D Density Map you have? I'm looking for exactly that
Thanks
Dave
 
Insights auto threads is broken atm, so I'm manually creating these for new Insight articles. In Dirac’s Principles of Quantum Mechanics published in 1930 he introduced a “convenient notation” he referred to as a “delta function” which he treated as a continuum analog to the discrete Kronecker delta. The Kronecker delta is simply the indexed components of the identity operator in matrix algebra Source: https://www.physicsforums.com/insights/what-exactly-is-diracs-delta-function/ by...
Fermat's Last Theorem has long been one of the most famous mathematical problems, and is now one of the most famous theorems. It simply states that the equation $$ a^n+b^n=c^n $$ has no solutions with positive integers if ##n>2.## It was named after Pierre de Fermat (1607-1665). The problem itself stems from the book Arithmetica by Diophantus of Alexandria. It gained popularity because Fermat noted in his copy "Cubum autem in duos cubos, aut quadratoquadratum in duos quadratoquadratos, et...
I'm interested to know whether the equation $$1 = 2 - \frac{1}{2 - \frac{1}{2 - \cdots}}$$ is true or not. It can be shown easily that if the continued fraction converges, it cannot converge to anything else than 1. It seems that if the continued fraction converges, the convergence is very slow. The apparent slowness of the convergence makes it difficult to estimate the presence of true convergence numerically. At the moment I don't know whether this converges or not.
Back
Top