views:

153

answers:

2

Whilst looking for a "B-V color index to temperature conversion formula"

I found this javascript:

   var C1 = 3.979145;
   var C2 = -0.654499;
   var C3 = 1.74069;
   var C4 = -4.608815;
   var C5 = 6.7926;
   var C6 = -5.39691;
   var C7 = 2.19297;
   var C8 = -.359496;
   bmv = parseFloat(BV);
   with (Math) {
           logt=
              C1
             +C2*bmv
             +C3*pow(bmv,2)
             +C4*pow(bmv,3)
             +C5*pow(bmv,4)
             +C6*pow(bmv,5)
             +C7*pow(bmv,6)
             +C8*pow(bmv,7);

          t=pow(10,logt);
   }

Which is supposed to convert B-V color index to temperature. Does anyone understand how this is working and if the output value is an approximation for temperature in celcius or kelvin?

Is it something to do with products of logarithms?

+4  A: 

The B-V index is basically a function that transforms the difference between the intensity of the light passing through a 'blue' resp. a 'visible' filter into a temperature.

This function can be approached as 109th degree polynomial, where the polynomial is basically C1*bv0 + C2*bv1 + ... + C8*bv7.

Since we're talking stellar temperatures, the output will be in Kelvin.

Note that a Horner algorithm for polynomial functions is often more precise...

xtofl
+1 for Horner Algorithm idea!
TheMachineCharmer
thank you for explaining
PeanutPower
+2  A: 

I think temperatures are in Kelvin because its very common for astronomers to use Kelvin rather than Celcius.

Look here.

And,

if logbaseX = Y then X = baseY

 log10(t)= C1 +C2*bmv +C3*pow(bmv,2) +C4*pow(bmv,3)
          +C5*pow(bmv,4) +C6*pow(bmv,5) +C7*pow(bmv,6) 
          +C8*pow(bmv,7); 

 t = pow(10,log10(t));

Also, this formula is very much related to Taylor Series.

// Horners algorithm for polynomials 
function Horner(a,n,x)
{
    var result = a[n];
    var i = n - 1;
    while( i >= 0)
    { 
       result = result*x + a[i];
       i-=1; 
    }
    return result;
}

In your case,

Array Cs = {C1,C2,C3,C4,C5,C6,C7,C8};
var temperature = Horner(Cs,8,bmv);
TheMachineCharmer
thanks I guess I should read up on Taylor Series :)
PeanutPower