Python Help with Python computation to calculate age of universe

AI Thread Summary
The discussion revolves around calculating the age of the universe using Python by determining the distance modulus for galaxies in the V and I bands. The user is encountering discrepancies in their results, specifically a Hubble constant that is ten times too large, which affects the calculated age of the universe. Key equations include the relationship between recession velocity and distance, as well as the distance modulus formula. The user seeks clarification on the term AVG_DPC_V and its significance in their calculations. They suspect that a misunderstanding in the mathematical expression, particularly regarding the placement of the +1 in the exponent of the distance calculation formula, may be the source of their errors. Proper formatting of code is also suggested to facilitate better understanding and troubleshooting.
Pavkazz
Messages
2
Reaction score
0

Homework Statement


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.

Homework Equations


vrec = H0*Dgal.
5 log dpc − 5 + AV = µ + AV

The Attempt at a Solution


Below is my code to work out hubbles constant. My Distance mod is accurate [/B]
 

Attachments

  • Screen Shot 2016-01-29 at 14.52.30.png
    Screen Shot 2016-01-29 at 14.52.30.png
    102.8 KB · Views: 536
Technology news on Phys.org
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.
 
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:
import numpy as np
x = 0.5
y = np.sin(x)
print "The sine of %f is %f"%(x,y)
 
mfb said:
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.
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)?
 
The +1 should be in the exponent, right.
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I have a quick questions. I am going through a book on C programming on my own. Afterwards, I plan to go through something call data structures and algorithms on my own also in C. I also need to learn C++, Matlab and for personal interest Haskell. For the two topic of data structures and algorithms, I understand there are standard ones across all programming languages. After learning it through C, what would be the biggest issue when trying to implement the same data...
Back
Top