Reading:
For each of the following exercises create a text file with your answer. See Exercise 4, below, for instructions for submitting your homework.
Using the GNU emacs editor, write a text document describing your experience with physics and with computers. Specifically,
Save your text file using the name exper.txt.
a) ls -l ~/* | awk '{print $3,$5}'
b) cat file2 file3 | grep collision > file4
c) ls -al / | sort -rn -k5
Note: The -l and -al in these exercises has the lower case letter l and not the number 1
Submit your answers in a textfile called unix.txt.
(Exercise and data thanks to B. Bromley) In ~p6720/examples/lcrs there is a file called lcrs.bright_gax containing a list of data from galaxies observed in the Las Campanas Redshift Survey. It is a four column text file except that the first few lines contain comments. Here is a sample line:
21910 2.30355501 0.721660018 -19.8176746The first column is recession velocity (km/s), the second two are polar angles theta and phi (radians), the last is absolute magnitude in red light. In what follows, treat recession velocity v as a radial distance so that the first three columns describe spherical coordinates in a 3D space, with the origin at the Sun. (To get an approximate real distance, just divide v by the Hubble constant, about 71 km/s/Mpc, where 1 Mpc = 1 megaparsec = 3.086x1024 cm.) In this case that would give a galaxy at a distance of approximately 21910/71 = 308 megaparsecs from the solar system at the given angles and absolute magnitude.
Note that absolute magnitude is a measure of the intrinsic brightness or luminosity (emitted energy per second) of a galaxy. Think of it as being measured nearly at the source. The observed or apparent brightness is generally reduced, of course, mainly by the 1/r2 law, where r is the distance from the observer. For historical reasons, more negative numbers mean brighter objects.
Use grep to strip off all lines containing comments and to create your own purely numerical data file. Then use sort (and whatever else you want) to find
a) the highest and lowest absolute magnitudes, and
b) the fastest and slowest recession velocities, and
c) the absolute magnitudes of the ten slowest receding galaxies and the absolute magnitudes of the ten fastest.
In each case give the Unix command(s) you used to obtain your answer.
[Hint: For the sort and grep commands see the Unix Introduction chapter. You might also want to look up the Unix head and tail commands.]
Did you notice that the fastest receding galaxies tend to have larger absolute magnitudes? Why might this be?
Answer: The survey was designed so that only galaxies with an apparent brightness larger than a fixed minimum brightness were included.
So in order to make the cut, distant galaxies had to be much brighter, so they have a larger absolute magnitude.
Put your answers to parts a-c in a text file called galaxies.txt.
This exercise tells you how to hand in your homework. No credit will be given for any of the above exercises if this last one is not completed--so please get help if you have trouble!
Please follow the instructions given here in the assignments web page.
The files to be submitted for this assignment are