MatthewMaynard.net Banner
Merry Christmas

[Previous entry: "New Categories and The Age of the Buffalo"] [Main Index] [Next entry: "Love Child!"]

Links
Topics
Glossary
Archives
Contact
BOTW Scorecard

Powered By Greymatter

Current Homeland Security Alert Level

CPU Brain Candy

RSS 1.0 FEED

Hand over the cash and no bytes get hurt.

Site Meter

Listed on BlogShares

This page contains valid HTML 4.01 code.

09/27/2002 Entry: "Kepler's 3rd Law is Broken"
Posted by Maynard @ 11:32 PM MST

Blue Bar

Astronomy
Kepler's 3rd Law is Broken

I've written a short Windows program that uses Kepler's 3rd Law to calculate the mass of an object based on it's orbital time in days and it's distance from its parent, in kilometers. However, I can get the answer in the ballpark but not any closer than that. The answer is correct in magnitude but not accuracy. If you have any ideas why this might be, drop me a line. Here's the program (zipped Windows exe). Click below to see how I do the actual calculation.

In the following C++ code, m_dDistance is the value the user enters, in kilometers, m_dTime is the orbital time, in days, and m_dMass is the mass in kilograms displayed to the user.

// convert to more manageble units
double d = m_dDistance * 1000; // convert kilometers to meters
double t = m_dTime * 24 * 60 * 60; // convert days to seconds

const double pi = 3.14159265358979323846;
const double FourPiPi = 4*pi*pi;
const double r3 = d * d * d ; // meters cubed
const double G = 6.6725985E-11; // big G

double Numerator = FourPiPi * r3;
double Denominator = G * t * t;

m_dMass = Numerator/Denominator; // this is in kilograms
m_dMass /= 1000000; // now it's in millions of kilograms

Blue Bar

Powered By Greymatter

This site is copyright 2001-2004 by Matthew Maynard. All rights reserved. All your trademarks, copyrights, insignia, and other distinguishing characteristics are belong to you. Sharks in suits make for good joke material. Don't leave a mess on your way out.

Links to external websites are valid at the time of article authoring and may decay as time goes by. But we'll always have Paris.

The opinions on this site are those of their author and do not represent anyone else's views. That is, unless and until you agree with them, at which point they become yours as well. Opinions expressed in the comments belong to the comment poster and may be edited for content. Play nice with others, since you want them to play nice with you.