T2: gravitational forces; vectors and loops;
using make and gnuplot
Before the tutorials:
Do, think about, and research the following:
- Bring your own program to the level of the example given for the last tutorial,
so that you can start from a clean and working version.
 - What is Lense-Thirring precession?
 - Where in our galaxy could it be important?
 - How does it compare to Newtonian acceleration?
Hint: have a look at equations (97,98) in this paper.
 - How do you define a simple vector in C++ (or C or Fortran)?
 - What is a loop in a programming language?
 - What is a class (in object-oriented programming)?
 - What is a “Makefile”?
 - What is gnuplot and how does it work?
 
During the tutorials:
Program it!
- Make yourself familiar with arrays in your language and write a program that
outputs a comparison between the Newtonian acceleration and the Lense-Thirring precession
of a star close to the galactic centre.
 - In your program, create a loop and calculate these values for a series of distances.
 - Plot the output with gnuplot.
 - Try to include the general definitions via an include file.
 - Write a simple “Makefile” to simplify compilation.
 
Maybe you can explore the power of C++:
- Try to define a vector class to simplify the program code. Place this class in an include file.
 - Try to define your own constructors.
 - Try to define member functions for adding vectors and multiplying vectors by numbers.
 - Try to overload standard operators to add vectors and to multiply vectors by numbers.
 
Sample code
Discussion of the results:
Plot your results with gnuplot to see at which distance
the Lense-Thirring effect becomes noticeable.
Where could it be even more important?
Programming goals for T2:
Goal of this tutorial is that you learn
how to use arrays and loops in a program.
You might even get to learn how classes work and
how this can simplify how you write mathematical expressions
in the program code.
In addition you should learn the concept of “Makefiles”
and how to plot data with gnuplot.