Practise Exercises

Jeremy Sanders

October 2011

Here are some exercises to make sure you understand the material. Feel free to invent your own.

Using ADS, NED, Simbad and SkyView

  1. Search for Pettini et al (1999). What journal was it in?
  2. Print the 1st page of Kennicutt (1998), ApJ, 498, 541
  3. Find all papers with Carswell as the first author between 1990 and 2000
  4. Find papers authored by Andy Fabian on the Abell 1795 cluster, after 2000
  5. Find all the papers which cite Navarro, Frenk & White, 1997, ApJ, 490, 493
  6. What is the redshift of the Coma cluster?
  7. What is the position of NGC 1000 in B1950 coordinates?
  8. Use SkyView to make a simple X-ray map of the Centaurus cluster. Save this image to disk as a fits file, get another image of the cluster in optical (DSS) for a similar area of sky. Use ds9 to make a contour map of the optical on the X-ray map.

Simple shell usage

  1. Make a file called me.txt containing your name. Can you keep emacs running while you continue typing in your shell?
  2. Make a new subdirectory in you home directory, test1.
  3. Copy the file me.txt into the subdirectory as me_copy.txt.
  4. Make sure you can use cd to move between your home directory and that subdirectory.
  5. Rename the copy to me_renamed.txt. Can you rename it when you are still in your home directory?
  6. Using echo and a shell redirection, add your date of birth to the copy.
  7. Using ls compare the size of the two files and understand why the size difference is what it is.
  8. Try using the diff command to compare the files.
  9. Delete the subdirectory and the copy of me.txt.
  10. Modify the permissions of me.txt so that no other users besides yourself can read it.
  11. Using pine send me.txt to one of the group (or your favourite email program).
  12. Try using date to add the date to the end of me.txt.
  13. Put two copies of me.txt (choose your own file names) into a new subdirectory (test2). Use gtar or tar to backup that directory to test2.tar.gz.
  14. Use tar or gtar to restore the contents into a directory test3.
  15. Type sleep 2000 &. Use ps to identify the process. Use kill to get rid of it. Try using top as well.
  16. How much disk space are you using in your home directory?

More complex shell usage

  1. Make two files, test.txt containing some text, and test.dat containing the text `test.txt'. What command line is required to use test.dat to print the contents of test.txt?
  2. Make a file containing two columns of numbers. Use awk to print out the average of each row and their sum. Use awk to print the sum of each column.
  3. Sort the output of the previous exercise on the first and then the second columns.
  4. Make a file containing text including the word red. Use sed to substitute green for red.
  5. Use the find command to find all files called *.txt in your home directory and subdirectories.
  6. Count the lines of the files listed from the above find command.
  7. Add /home/username/testdir to your PATH environment variable.
  8. Show the text `() $<>$;&' using the echo command.

Basic LATEX usage

  1. Write a simple LATEX document to print out your name and your previous university.
  2. Add a title, author and date to the document.
  3. Add a second paragraph containing the equations $V=IR$, $\alpha
= \beta + \gamma$, $a=\frac{b}{c}$, $N_\mathrm{H} = 10^{22} \:
\mathrm{cm^{-2}}$, $a=\int_0^8{x^2 \mathrm{d}x}$.
  4. Add section heading before the first paragraph `Introduction', and add a subsection heading before the second, `Equations'.
  5. Use emacs to spell check the document.
  6. Use emacs to search and replace 22 with 23.
  7. Use emacs to switch round the first and second paragraphs.
  8. Can you use emphasised, SMALL CAPS, typewriter, and sans-serif?
  9. Make a table with two columns, e.g. `animal' and `can it fly?'. Add some data entries to the table. Change the alignment of the columns in the table.
  10. Add an equation environment to your document (
    begin{equation} ...
    end{equation}) containing an equation. Use a label to refer to the equation in your text.
  11. Use a label to refer to your table in your text.


  1. Generate points in a file ($x, y$, with $y = x^2 + 1$). Plot the points. Also plot with lines between the points.
  2. Make the axis labels ``The X Axis'' and ``The Y Axis''.
  3. Generate a postscript file from the plot.
  4. Add $y$ error bars to the plot, where $\sigma = 0.25$.
  5. Add a second data series of your own choosing.

More complex usage of LATEX

  1. Take the postscript file from the plotting exercises and insert it in your LATEX document.
  2. Make a table with three columns in the document (choose your own data). Place horizontal lines before and after the rows.
  3. Take some papers from ADS and construct a BibTeX archive. Make sure that you can use it within an article.
  4. For the more adventurous, take figure 6 from astro-ph/0109336, and place it in your paper.
  5. Make a simple paper using the Monthly Notices style file (for postgraduates only).

Shell scripting

  1. Write a shell script to start two xterms.
  2. Write a shell script to take a list of files, and print out the sorted list of the sizes of the files.
  3. Write a shell script to run latex three times on all its input files. The script should then generate postscript and pdf files for each.
  4. Write a shell script to rename all files call *.txt to *.txt.old

Python programming

  1. Write a script to multiply the first column of a file by 20.
  2. Write a script to generate $x$ and $x^2$ if $x$ goes from 0 to 10 in steps of 0.1.

About this document ...

Practise Exercises

This document was generated using the LaTeX2HTML translator Version 2008 (1.71)

Copyright © 1993, 1994, 1995, 1996, Nikos Drakos, Computer Based Learning Unit, University of Leeds.
Copyright © 1997, 1998, 1999, Ross Moore, Mathematics Department, Macquarie University, Sydney.

The command line arguments were:
latex2html -split 0 -font_size 10pt -no_navigation exercises.tex

The translation was initiated by Jeremy Sanders on 2011-10-02

Jeremy Sanders 2011-10-02