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. :)
 
TL;DR Summary: In 3 years, the Square Kilometre Array (SKA) telescope (or rather, a system of telescopes) should be put into operation. In case of failure to detect alien signals, it will further expand the radius of the so-called silence (or rather, radio silence) of the Universe. Is there any sense in this or is blissful ignorance better? In 3 years, the Square Kilometre Array (SKA) telescope (or rather, a system of telescopes) should be put into operation. In case of failure to detect...
Thread 'Could gamma-ray bursts have an intragalactic origin?'
This is indirectly evidenced by a map of the distribution of gamma-ray bursts in the night sky, made in the form of an elongated globe. And also the weakening of gamma radiation by the disk and the center of the Milky Way, which leads to anisotropy in the possibilities of observing gamma-ray bursts. My line of reasoning is as follows: 1. Gamma radiation should be absorbed to some extent by dust and other components of the interstellar medium. As a result, with an extragalactic origin, fewer...
This thread is dedicated to the beauty and awesomeness of our Universe. If you feel like it, please share video clips and photos (or nice animations) of space and objects in space in this thread. Your posts, clips and photos may by all means include scientific information; that does not make it less beautiful to me (n.b. the posts must of course comply with the PF guidelines, i.e. regarding science, only mainstream science is allowed, fringe/pseudoscience is not allowed). n.b. I start this...

Similar threads

Back
Top