A Space & astronomy forum. SpaceBanter.com

Go Back   Home » SpaceBanter.com forum » Astronomy and Astrophysics » Astronomy Misc
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, 12:43 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





  #2  
Old July 14th 03, 01:13 PM
Alexander Duerloo
external usenet poster
 
Posts: n/a
Default Apparent & absolute magnitude

maybe you should move on to another newsgroup where you can fully express
your psychological problems, cypherpunk that would make us all happy

schreef in bericht
...
Alexander Duerloo wrote:
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:

BEEP


Heh - kids.



  #3  
Old July 14th 03, 07:00 PM
Greg Neill
external usenet poster
 
Posts: n/a
Default Apparent & absolute magnitude

"Alexander Duerloo" wrote in message
...
by the way, what do you mean with low-quality code

schreef in bericht
...
Alexander Duerloo wrote:
maybe you should move on to another newsgroup where you can fully

express
your psychological problems, cypherpunk that would make us all happy


And maybe you should not post such poor quality
source code to the Internet, if you want to
avoid ridicule.


Don't let the flamers get you down, Alexander. At
least you contributed some technical content. We
could do with more of it, and at all levels of
expertise.

If you enjoy tinkering with BASIC code in an
astronomy vein, I invite you to take a look at
the contents of The Orrery newsletter:

http://members.attcanada.ca/~gneill/


  #6  
Old July 15th 03, 08:40 PM
Gautam Majumdar
external usenet poster
 
Posts: n/a
Default Apparent & absolute magnitude

On Sat, 12 Jul 2003 12:43:34 +0100, Alexander Duerloo wrote:

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:

Thanks Alexander. It is a nice little program. I am sure I shall use it.
Its a long time since such a little gem appeared in this ng.

--

Gautam Majumdar

  #7  
Old July 16th 03, 01:02 PM
Alexander Duerloo
external usenet poster
 
Posts: n/a
Default Apparent & absolute magnitude

Here are the formulas used in the program:

M=Absolute magnitude
m=Apparent Magnitude
d=Distance (parsec)

M = m - ((-5) + 5 log d)
m = M + ((-5) + 5 log d)
d = 10 ^ (0.2 (m - M + 5))

If you are smarter than you seem to be you could now easily reconstruct the
program


  #8  
Old July 16th 03, 06:54 PM
Paul Schlyter
external usenet poster
 
Posts: n/a
Default Apparent & absolute magnitude

In article ,
wrote:

It's been years since I stopped doing math and switched to
using the computer (lots of numbers, but for abstracts),
but I think I remember e: 2.71828184590452356...


....except that it should read: 2.71828182845904523536028747135...
....so you skipped a "28" sequence there..... and your last digit
shouldn't be 6..... :-)

Personally I remember it this far: 2.718281828

The repetition of "1828" is what I remember most easily.

--
----------------------------------------------------------------
Paul Schlyter, Grev Turegatan 40, SE-114 38 Stockholm, SWEDEN
e-mail: pausch at stockholm dot bostream dot se
WWW: http://www.stjarnhimlen.se/
http://home.tiscali.se/pausch/
  #9  
Old July 16th 03, 07:31 PM
Bill Owen
external usenet poster
 
Posts: n/a
Default Apparent & absolute magnitude

Paul Schlyter wrote:

In article ,
wrote:

It's been years since I stopped doing math and switched to
using the computer (lots of numbers, but for abstracts),
but I think I remember e: 2.71828184590452356...


...except that it should read: 2.71828182845904523536028747135...
...so you skipped a "28" sequence there..... and your last digit
shouldn't be 6..... :-)

Personally I remember it this far: 2.718281828

The repetition of "1828" is what I remember most easily.


The "459" isn't hard either.
1828 = the year after Beethoven died
4, 5, 9 = his three most widely known symphonies

At least that's how my applied math teacher explained it, and it must
work, because almost 30 years later I still remember it. :-)

-- Bill
  #10  
Old July 18th 03, 06:52 AM
Alexander Duerloo
external usenet poster
 
Posts: n/a
Default Apparent & absolute magnitude

no problem


 




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 - November 26, 2003 Ron Baalke History 2 November 28th 03 09:21 AM
Space Calendar - October 24, 2003 Ron Baalke History 0 October 24th 03 04:38 PM
Space Calendar - September 28, 2003 Ron Baalke History 0 September 28th 03 08:00 AM
Space Calendar - August 28, 2003 Ron Baalke History 0 August 28th 03 05:32 PM
Space Calendar - July 24, 2003 Ron Baalke History 0 July 24th 03 11:26 PM


All times are GMT +1. The time now is 10:26 PM.


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.