Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Star density calculation = weird result.

  1. Aug 8, 2011 #1
    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 [Broken]
    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: May 5, 2017
  2. jcsd
  3. Aug 8, 2011 #2

    Janus

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    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.
     
  4. Aug 9, 2011 #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. :)
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Star density calculation = weird result.
Loading...