A Space & astronomy forum. SpaceBanter.com

Go Back   Home » SpaceBanter.com forum » Others » UK Astronomy
Site Map Home Authors List Search Today's Posts Mark Forums Read Web Partners

Apparent & absolute magnitude



 
 
Thread Tools Display Modes
  #1  
Old July 12th 03, 05:24 PM
Alexander Duerloo
external usenet poster
 
Posts: n/a
Default Apparent & absolute magnitude

I have made a simple program that calculates the absolute magnitude when you
give the distance and apparent magnitude. it can also calculate apparent
magnitude and distance. You can download it at
http://users.pandora.be/alex.duerloo/MAGNIT.EXE (41 Kb) If you want the
code, here it is, it's written in QBasic 4.5:

DECLARE FUNCTION LOGAR10! (X!)

10 DO
CLS
PRINT "Magnitude calculator by Alexander Duerloo (2003)"
PRINT ""
PRINT ""
PRINT "What do you want to calculate?"
PRINT ""
PRINT "1. The absolute magnitude of a star"
PRINT "2. The apparent magnitude of a star"
PRINT "3. The distance of a star"
PRINT "4. Exit"
PRINT ""
ch$ = INPUT$(1)
ch = INT(VAL(ch$))
IF ch 0 AND ch 5 THEN
EXIT DO
END IF
BEEP
LOOP
CLS
SELECT CASE ch
CASE 1
INPUT "What's the apparent magnitude of the star"; apmag
INPUT "What's the distance of the star (in light-years)"; dist
dist = dist / 3.26
abmag = apmag - ((-5) + (5 * LOGAR10(dist)))
PRINT ""
PRINT "The absolute magnitude of the star is "; abmag; "."
PRINT ""
SHELL "pause"
CASE 2
INPUT "What's the absolute magnitude of the star"; abmag
INPUT "What's the distance of the star (in light-years)"; dist
dist = dist / 3.26
apmag = abmag + ((-5) + (5 * LOGAR10(dist)))
PRINT ""
PRINT "The apparent magnitude of the star is "; apmag; "."
PRINT ""
SHELL "pause"
CASE 3
INPUT "What's the apparent magnitude of the star"; apmag
INPUT "What's the absolute magnitude of the star"; abmag
dist = 10 ^ (.2 * (apmag - abmag + 5))
PRINT ""
PRINT "The distance of the star is "; dist * 3.26; "light-years."
PRINT ""
SHELL "pause"

CASE 4
SYSTEM
END SELECT
GOTO 10



FUNCTION LOGAR10 (X) STATIC
LOGAR10 = LOG(X) / LOG(10#)
END FUNCTION







 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Space Calendar - January 27, 2004 Ron Astronomy Misc 7 January 29th 04 09:29 PM
Space Calendar - November 26, 2003 Ron Baalke History 2 November 28th 03 09:21 AM
Space Calendar - November 26, 2003 Ron Baalke Astronomy Misc 1 November 28th 03 09:21 AM
Space Calendar - October 24, 2003 Ron Baalke History 0 October 24th 03 04:38 PM
Space Calendar - October 24, 2003 Ron Baalke Astronomy Misc 0 October 24th 03 04:38 PM


All times are GMT +1. The time now is 11:42 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 SpaceBanter.com.
The comments are property of their posters.