Android Question Help: Ans = Infinity

Discussion in 'Android Questions' started by wonder, May 15, 2015.

  1. wonder

    wonder Expert Licensed User

    So, I'm working on a little science project:
    Code:
    Dim G          = 6.67 * Power(10, -11as Float
    Dim Earth_Mass = 5.97 * Power(10,  24as Float 'in kilograms
    Dim Sun_Mass   = 1.99 * Power(10,  30as Float 'in kilograms
    Dim Distance   = 1.5  * power(10,  11as Float 'in meters
    [​IMG]
    Code:
    Dim Gravitational_Force = (G * Sun_Mass * Earth_Mass) / Power(Distance, 2as Float
    Log(Gravitational_Force)
    Output: Infinity

    I'm getting "Infinity" instead of the actual value.
    How can I handle such big numbers? Any suggestions?
    I'm not a math wizzard...
     
  2. thedesolatesoul

    thedesolatesoul Expert Licensed User

    If you change the order to:
    Code:
    Log((G*Sun_Mass/Power(Distance,2))*Earth_Mass)
    it outputs 3.521849211074262E22
    Not sure if that is the correct value.
    Alternatively you need the BigNumbers library.
     
    NJDude and wonder like this.
  3. thedesolatesoul

    thedesolatesoul Expert Licensed User

    NJDude and wonder like this.
  4. wonder

    wonder Expert Licensed User

    RandomCoder likes this.
  5. thedesolatesoul

    thedesolatesoul Expert Licensed User

    Because you ask interesting questions in a way I can try them :)
     
    NJDude, wonder and RandomCoder like this.
  6. wonder

    wonder Expert Licensed User

    I woke-up yesterday with the urge to build a miniature solar system. :D
    I'm trying to get stable orbits while inputing real data.
    So far all I managed to do, was to crash a few planets into the Sun.

    Files:
    [​IMG]

    Photoshop concept art:
    [​IMG]
     
  7. thedesolatesoul

    thedesolatesoul Expert Licensed User

    If you are applying a singular force to the planet that is where it will go?
    I'm not sure what other forces play a factor to keep it in orbit.
     
    NJDude likes this.
  8. wonder

    wonder Expert Licensed User

    Well, I haven't got it to work properly yet, but last night I was temporarily able to get some stable orbits.

    I have only two velocity vectors.
    [​IMG]
    Vector A is the planet's linear speed (30 km/sec).
    Vector B is perpendicular to vector A and it's accelerated towards the Sun.
    Code:
    Sub Acceleration_Towards_The_Sun(planet_index As Int) As Double
        
    Return (G * SpaceBody(Sun).Mass) / Power(Distance_Between_Two_SpaceBodies_in_Meters(planet_index, Sun), 2)
    End Sub
    Once I have it all figured out, I'll share the code. :)
     
  9. thedesolatesoul

    thedesolatesoul Expert Licensed User

    I need to take out my old books but I believe vector B needs to be a combination of the centripetal and centrifugal forces that would keep 'r' constant.
    Let me know whenever you make more interesting progress!
     
    NJDude and wonder like this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice