1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Help with Python computation to calculate age of universe

  1. Jan 29, 2016 #1
    1. The problem statement, all variables and given/known data
    I'm using python to calculate the age of the universe, by working out the distmodulus for a set of galaxys (using the V and I bands) then working out the distance in parsecs and then hubbles constant etc... I keep getting values that are 10s of magnitudes out which I assume has something to do with my unit conversion.

    2. Relevant equations
    vrec = H0*Dgal.
    5 log dpc − 5 + AV = µ + AV
    3. The attempt at a solution
    Below is my code to work out hubbles constant. My Distance mod is accurate

    Attached Files:

  2. jcsd
  3. Jan 29, 2016 #2


    User Avatar
    2017 Award

    Staff: Mentor

    What is AVG_DPC_V and what does the formula calculating it mean? What is f?
    The Hubble constant is a factor 10 too large, that error propagates to the age of the universe.
  4. Jan 29, 2016 #3


    User Avatar
    Science Advisor

    By the way, if you enclose your code in "code" tags, we can see your code with the appropriate formatting and even run it if we like. This makes it easier for people to understand code related questions. Below is an example.

    Code (Text):

    import numpy as np
    x = 0.5
    y = np.sin(x)
    print "The sine of %f is %f"%(x,y)
  5. Jan 29, 2016 #4
    Average distance in the V band and the formula calculating is (5 log dpc − 5 + AV = µ + AV) which is dpc = 10^u/5 + 1. I think I may have solved the issue? Is it simply the bracket in the equation above where I am calculating (10^u/5) +1 not 10^(u/5 + 1)?
  6. Jan 29, 2016 #5


    User Avatar
    2017 Award

    Staff: Mentor

    The +1 should be in the exponent, right.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted