Name _____________________________________________ Date ______________
Start IDL. We are going to use the JOURNAL function to start a journal file and record your session for emailing to your instructor before the assignment due date.
Before you get too far along in this assignment, it's best of you practice starting and stopping a journal file. Inspect the file to see what kinds of communications between you and the IDL session are actually recorded. Journal files are actually written to disk by IDL only after another JOURNAL command or EXIT. It would be horrible if you put in hours of work and all was lost.
NOTE: There are questions embedded within this exercise. You can include them in your work as follows at the IDL prompt:
IDL> ;this is an answer to one of the questions posed within this exercise
IDL> ;the semi-colon tells IDL to ignore what comes after it, but my instructor won't
Before starting the exercises, give the IDL command:
IDL> ON_ERROR,1
This will return control to the main program level if an error occurs in a called routine.
Practice with Scalars and Strings
Simple Array Functions
C = A+1
C = A*0
C = A^2
C = A*(A+3)
C = A/A
C = EXP(A)
C = A+B
C = A*B
C = A(*,2)*B
C = A(4,2)*B
When we calculate the absorption coefficient for atomic hydrogen, we are going to need something called the gaunt factor. For the gaunt factor for bound-free transitions:
![]()
Here, m represents the quantum number of the m th state, and x is the inverse wavelength, with the wavelength in microns. Here is a table of the coefficients a, b, and c:
m |
am |
bm |
cm |
m |
am |
bm |
cm |
1 |
0.9916 |
0.09068 |
-0.2524 |
6 |
1.097 |
0. |
0. |
2 |
1.105 |
-0.7922 |
0.4536 |
7 |
1.098 |
0. |
0. |
3 |
1.101 |
-0.329 |
0.1152 |
8 |
1. |
0. |
0. |
4 |
0.9736 |
0. |
0. |
9 |
1. |
0. |
0. |
5 |
1.03 |
0. |
0. |
10 |
1. |
0. |
0. |
Construct 3 arrays a, b, c of 10 elements each, with these coefficients. Call the dependent variable something like 'gauntbf.' Notice that decimals are included for all of the values. This is to ensure that IDL recognizes the numbers as floating-point and not integer. (It may not make a difference, but in old programming switching between floating-point and integer caused unexpected bad results.)
We will work with these arrays further in assignment 3, but, for now test your program for m = 2 and a wavelength of 5000 Angstroms (how about converting the wavelength to inverse in microns within the IDL program?). Remember: your array indices start with '0' so you don't want a[2], b[2], or c[2] . Which array elements do you want?