Star density calculation = weird result.

AI Thread Summary
The discussion revolves around the challenges faced in calculating star density for a fictional galaxy in game development. The developer uses stellar properties from Wikipedia to generate stars but encounters an issue with the density calculations yielding excessively high values. The problem was traced to a misunderstanding of units, specifically mixing kilometers with meters, leading to incorrect density results. The correct density should be expressed in grams per cubic centimeter rather than kilograms per cubic kilometer. Ultimately, the developer resolved the issue by clarifying the unit conversions involved in the calculations.
Adyaphede
Messages
3
Reaction score
0
Hello everyone!

I'm new here and I've checked this forums once in a while for physics information, mainly astrophysics stuff but I usually found all the answers I needed. Not this time though.

A bit about me.
I'm an Indie game developer and the game I'm working on takes place in a fictional galaxy generated from scratch. The scale of that galaxy goes from tiny to 1% realist (or about 1 billion stars) some would argue this scale would be .5%.

Galaxy generation can yield 3 types of galaxies: spiral, barred or elliptical.

Based on the stellar types and some generalization based on those types, all stars are generated and placed according to the type of galaxy.

Each star has its own properties set like mass, radius, etc based on its type. I take each type's upper and lower limits from the Stellar Type's page on wikipedia for each attribute and randomize from lower to upper limit.

My problem is the density I am getting for a given type in relation to Sol.

Each star, when selected, gives a report of sort, informing the player of the star's attributes in Sol.

So for example you could get for an M class star: "Radius: 0.67 Sol"

To come up with the star's density, I come up with its radius multiplied by sol's radius (because the types' limits are in Sol, so I have to mult it by Sol to get the star's real radius).

Then I get the star's mass using the same as above mult by Sol's mass.

The star's volume comes next and this is derived from the star's radius (4/3 * PI * radius^3).

Last, to get the density, it's mass / volume.

That's the contention point. I always get an awful number (usually around 10 digits) after being divided by Sol's density. This can't be right.

Might as well put a screenshot so it's easier to see/understand.

[PLAIN]http://www.danyrioux.com/files/weird_density.png
In the picture above, the star's attributes were:
Star Mass : 3.5223205E30
Star Volume : 4.14757254E18
Star Density : 8.4924871E11

Since Sol's density is 1.408E3, I understand the huge result and that it's wrong (obviously), but what I don't understand is why.

Any help would be appreciated. If you need more information I'll gladly reply asap.
 
Last edited by a moderator:
Astronomy news on Phys.org
My guess is that when you are multiplying by Sol's radius, you are using the value in kilometers rather than in meters, This gives you an answer of kg/km^3 rather than what you want which is kg/m^3.
 
That was exactly it Janus.

In fact, the answer I needed was in g/cm3 but was getting the information in kg/km3 as you said. It took a while but found it.

Thanks. :)
 
Is a homemade radio telescope realistic? There seems to be a confluence of multiple technologies that makes the situation better than when I was a wee lad: software-defined radio (SDR), the easy availability of satellite dishes, surveillance drives, and fast CPUs. Let's take a step back - it is trivial to see the sun in radio. An old analog TV, a set of "rabbit ears" antenna, and you're good to go. Point the antenna at the sun (i.e. the ears are perpendicular to it) and there is...
3I/ATLAS, also known as C/2025 N1 (ATLAS) and formerly designated as A11pl3Z, is an iinterstellar comet. It was discovered by the Asteroid Terrestrial-impact Last Alert System (ATLAS) station at Río Hurtado, Chile on 1 July 2025. Note: it was mentioned (as A11pl3Z) by DaveE in a new member's introductory thread. https://www.physicsforums.com/threads/brian-cox-lead-me-here.1081670/post-7274146 https://earthsky.org/space/new-interstellar-object-candidate-heading-toward-the-sun-a11pl3z/ One...

Similar threads

Back
Top