Part 3E: Calculating Magnitudes (OPTIONAL)

In this optional part, we will look at two equations to convert between brightness ratios and magnitude differences. This will allow you to use, and get results that contain decimals.

**NOTE: The “counts” collected by a pixel need to be converted to flux, which is sometimes called intensity and sometimes called brightness (confusing!!!). Why? “Counts” needs to be in a unit that relates energy to the area of a pixel and the length of time of the exposure. Flux (or intensity, or brightness) fits the requirement. This conversion is done with a standard algorithm in most image processing software. Just know the flux is roughly proportional to the “counts”.

The equations used to find precise magnitudes or ratios need more powerful math than the simple math commands we have been using in Quorum.

A PDF of a textfile of the commands of this Part is available at this link:

Section 3E Quorum Commands (Optional)


This finds the flux (also can be called intensity) ratio knowing the apparent magnitudes.


The flux of ObjectA divided by the flux of ObjectB = (2.512) multiplied by itself the number of times equal to the absolute value of the difference between the magnitude of ObjectB and the magnitude of ObjectA.

  • Let’s see what we need in order to translate it into an equation Quorum can solve.

a) First, it will require the Quorum math library. You may want to open the documentation (list of commands) of Quorum’s math library, which is located at the following link:

Quorum Math Library Documentation

To write the code needed, let’s start on the right side of the equation:

1. First, we need the magnitude of Object A and the magnitude of Object B.

  • These will require “input” statements.
  • We will assign number variables magA and magB to these input statements.

2. Then we need the ABSOLUTE VALUE of the difference in magnitudes, magB minus magA, of the objects we are interested in.

  • Do you remember what absolute value means? It simply means, the size (magnitude) of a real number regardless of its sign.
  • Also, by taking the absolute value, it does not matter if you put magA or magB first in the equation.

3. Next, we need the RESULT when 2.512 is multiplied by itself the number of times that is equal to the difference in magnitudes.

Now we are ready to write a script to find the flux ratio given any two magnitudes:

A) First, open a new Quorum Box with the link below.

Quorum Box

Then, TYPE IN (or copy the highlighted code) into the Quorum Box:

use Libraries.Compute.Math

B) Since we are using a library, we need to define an object to use with the library.

  • I am using mag for magnitude, but you can use math, or mathprob, etc.
  • This is simular to how we used m1 for matrices, i.e., Matrix m1.
Math mag

C) Make input statements that change, or cast, the input text into numbers (we are using the variables magA and magB):

number magA = cast(number, input(“What is apparent magnitude of Object A?”))
number magB = cast((number, input(“What is apparent magnitude of Object B?”))

D) Now use the Math object (in my case, mag) to find the absolute value and store it into a new variable, absValue:

number absValue = mag:AbsoluteValue(magA-magB)

E) When you raise 2.512 to this number, which is the same as multiplying 2.512 by itself the number of times you found for magB-magA, the answer is the ratio you are looking for:

number Ratio =mag:RaiseToPower(2.512, absValue)

F) You can round to how many decimals you would like by typing that number after the variable in the parentheses; then output the answer to the console window:

number IntensityRatio = mag:Round(Ratio,0)
output IntensityRatio

3. Once you have a successful build, do the problems below. Record your answers in the JOURNAL Box. Compare your answers to others in your group or class.

  • a) Given StarA has a magnitude of 8.6 and Star B has a magnitude of 3.2, find the intensity ratio of the two stars. Explain what this ratio means about the two Stars.
  • b) Given Star A has a magnitude of 2.8 and an unknown asteroid has a magnitude of 15.6, find the count ratio. What does your answer mean?
  • c) What could be done if we did not know the magnitude of the asteroid, but we did know the intensity ratio, and we knew StarA was a standard star?



1. What if instead of finding the intensity ratio, you wanted to find the magnitude difference? What would that equation look like?

  • Looking at the first equation, you should realize we need to find the number that 2.512 is raised to. This number is the power, and it is equal to the magnitude difference.
  • This type of problem uses a logarithm of base ten. If you are not familiar with logs, just follow the code below. At some point in your math classes you will be introduced to this type of math operation.

2. Using the equation from the first exercise, it is rearranged and reads like this:

The difference between the magnitude of Object B and the magnitude of Object A is equal to 2.512 times the log of the flux of Object A divided by the flux of Object B. (The words Brightness or Counts could be substituted for the word flux)

3. Sounds confusing, but let’s look at what is needed for this equation:

  • a) The flux of Object A and the flux of Object B will be input statements.
  • b) Next, we need the RESULT of the log of the answer to the Intensity of Object A divided by the Intensity of Object B. The Quorum math library will do this for us.
  • c) Finally, we need to multiply the result by 2.512.

4. We are now ready to write the script. You may use the same Quorum Box you used above, but delete the code that is there. We start with the math library:

use Libraries.Compute.Math

A) I will use the same math object as above, “mag”

Math mag

B) The input statements will be similar to those of Activity #1

number fluxA = cast(number, input(“What is the flux of Object A?”))
number fluxB = cast(number, input(“What is the flux of Object B?”))

C) Now let’s divide the fluxes and take the log:

number log = mag:Logarithm(fluxA/fluxB)

D) The result needs to be multipled by 2.512. Do you remember where this number comes from?

number magnitudeDiff = 2.512*log
output magnitudeDiff

**Two notes: You may round this number as you did in Activity #1, and you may drop the negative sign. If you want to find the apparent magnitude of ONE of the objects, then do not drop the negative sign.

5. Once you have a successful build, do the problems below. Record in your journal.

  • a) An image is taken of an asteroid and found to have a flux of 500. A standard star in the same image has a flux of 20,000. What is the magnitude difference between the standard star and the asteroid?
  • b) In another image of the same asteroid, the flux was found to be 750. The standard star in this image has a flux of 21,000. What is the magnitude difference?
  • c.) Write an additional line of code to find the apparent magnitude of the asteroid if the standard star is know to have an apparent magnitude of 3.8. Then find the apparent magnitude of the asteroid for the two images.


The next parts will further explore finding the apparent magnitude of the asteroid by using photometry and standard stars.