« Laptop Repaired, well done PC ServiceCall | Main | Blog In Space »

SQL and distance modulus


This actually does something rather useful (maybe a first for my blog!), well to me anyway. It returns the distance modulus (the logarithm of the ratios of apparent to absolute brightnesses, equal to the difference of absolute magnitude to apparent magnitude) using an approximate method for calculating the luminosity distance (the distance at which an astronomical body would lie based on its observed luminosity in the absence of any unanticipated attenuation) so that numerical integration is avoided. The approximate method essentially is to use a CDM Universe. Since I don't need this to be the most accurate this method should be fine however if I find this isn't suitable I will have to go back to the lambda CDM and do the numerical integration. Anyway here is the SQL code I have used for this task (the useful line begins with a CAST):



SELECT

objID AS objID, plate AS plate, mjd AS mjd, fiberid AS fiberid, z AS Z,

CAST ( -5.0000000 * LOG10(8450700000 * ((1 + z) - (SQRT(1 + z))) / 10 ) as float) as D_MOd


INTO mydb.z_2


FROM mydb.z_1



Terms confusing?? Take a look at these links for more:


Distance Modulus - [Wolfram]

Luminosity Distance - [Wolfram]

Numerical Integration - [Wikipedia]

Dark Matter - [Martin White]

About

This page contains a single entry from the blog posted on July 27, 2005 1:10 AM.

The previous post in this blog was Laptop Repaired, well done PC ServiceCall.

The next post in this blog is Blog In Space.

Many more can be found on the main index page or by looking through the archives.

Get Firefox! Valid XHTML 1.0! Valid CSS! RSS Feed BlogUniverse - listed Powered by Apache Creative Commons License ringsofsaturnrock's Most Interesting Photos on Flickriver

Powered by
Movable Type 3.38