Previous
ToC
Up
Next
Contents
0. Preface
0.1. Acknowledgments
1. The Universe in a Computer
1.1. Gravity
1.2. Galactic Suburbia
1.3. Globular Clusters
1.4. Galactic Nuclei
1.5. Star Forming Regions
1.6. Open Clusters
1.7. Writing your own star cluster simulator
2. The Gravitational N-Body Problem
2.1. Background
2.2. Our Setting
2.3. Fun and Profit
2.4. What is the Problem, and why N and Bodies?
3. The Gravitational 2-Body Problem
3.1. Absolute Coordinates
3.2. Coordinate Systems
3.3. A Fourth Point
3.4. Center of Mass
3.5. Relative Coordinates
4. A Gravitational 1-Body Problem
4.1. Coordinates
4.2. Equivalent coordinates
4.3. Closing the Circle
4.4. Newton's Equations of Motion
4.5. An Equivalent 1-Body Problem
4.6. Wrapping Up
5. Writing the Code
5.1. Choosing a Computer Language
5.2. Choosing an Algorithm
5.3. Specifying Initial Conditions
5.4. Looping in Ruby
5.5. Interactive Ruby:
irb
5.6. Compiled vs. Interpreted vs. Interactive
5.7. One Step at a Time
5.8. Printing the Result
6. Running the Code
6.1. A Surprise
6.2. Too Much, Too Soon
6.3. A Circular Orbit
6.4. Radial Acceleration
6.5. Virial Theorem
6.6. Circular Motion
6.7. One Step at a Time
7. Debugging the Code
7.1. One Integration Step: Verification
7.2. A Different Surprise
7.3. One Integration Step: Validation
7.4. More Integration Steps
7.5. Even More Integration Steps
7.6. Printing Plots
8. Convergence for a Circular Orbit
8.1. Better Numbers
8.2. Even Better Numbers
8.3. An Even Better Orbit
8.4. Reasons for Failure
8.5. Signs of Hope
9. Convergence for an Elliptic Orbit
9.1. Adding a Counter
9.2. Sparse Output
9.3. Better and Better
9.4. A Print Method
9.5. From One Body to Two Bodies
10. The Modified Euler Algorithm
10.1. A Wild Idea
10.2. Backward and Forward
10.3. On Shaky Ground
10.4. Specifying the Steps
10.5. Implementation
10.6. Experimentation
10.7. Simplification
10.8. Second Order Scaling
11. Arrays
11.1. The DRY Principle
11.2. Vector Notation
11.3. Arrays
11.4. Declaration
11.5. Classes
12. Array Methods
12.1. An Array Declaration
12.2. Three
Array
Methods
12.3. The Methods
each
and
each_index
12.4. The
map
Method
12.5. Defining a Method
12.6. The
Array#inject
Method
12.7. Shorter and Shorter
12.8. Enough
13. Overloading the
+
Operator
13.1. A DRY Version of Modified Euler
13.2. Not quite DRY yet
13.3. Array Addition
13.4. Who is Adding What
13.5. The
plus
Method
13.6. The
+
Method
13.7. A Small Matter: the Role of the Period
13.8. Testing the
+
Method
13.9. A
Vector
Class
14. A
Vector
Class with
+
and
-
14.1.
Vector
Subtraction
14.2. Unary
+
14.3. Unary
-
14.4. An Unexpected Result
14.5. Converting
14.6. Augmenting the
Array
Class
14.7. Fixing the Bug
15. A Complete
Vector
Class
15.1.
Vector
Multiplication
15.2. An Unnatural Asymmetry
15.3.
Vector
Division
15.4. The Score: Six to One
15.5. A Solution
15.6. Augmenting the
Fixnum
Class
15.7. Augmenting the
Float
Class
15.8.
Vector
Class Listing
15.9. Forward Euler in Vector Form
16. A Matter of Speed
16.1. Slowdown by a Factor Two
16.2. A C Version of Forward Euler
16.3. A Simple Ruby Version
16.4. A Ruby Array Version
16.5. A Ruby Vector Version
16.6. More Timing Precision
16.7. Conclusion
17. Modified Euler in Vector Form
17.1. An Easy Translation
17.2. Variable Names
17.3. Consistency
17.4. A Method Returning Multiple Values
17.5. Simplification
18. Leapfrog
18.1. Interleaving Positions and Velocities
18.2. Time Symmetry
18.3. A Vector Implementation
18.4. Saving Some Work
18.5. The DRY Principle Once Again
19. Time Reversibility
19.1. Long Time Behavior
19.2. Discussing Time Symmetry
19.3. Testing Time Symmetry
19.4. Two Ways to Go Backward
19.5. Testing a Lack of Time Symmetry
20. Energy Conservation
20.1. Kinetic and Potential Energy
20.2. Relative Coordinates
20.3. Specific Energies
20.4. Diagnostics
20.5. Checking Energy
20.6. Error Growth
20.7. Pericenter Troubles
21. Scaling of Energy Errors
21.1. A Matter of Time
21.2. A New Control Structure
21.3. Overshooting
21.4. Knowing When To Stop
21.5. Linear Scaling
21.6. Picture Time
22. Error Scaling for 2nd-Order Schemes
22.1. Modified Euler
22.2. Energy Error Scaling
22.3. Leapfrog
22.4. Another Error Scaling Exercise
22.5. Roundoff Kicks In
23. Error Behavior for 2nd-Order Schemes
23.1. Modified Euler: Energy Error Peaks
23.2. Almost Too Good
23.3. Leapfrog: Peaks on Top of a Flat Valley
23.4. Time Symmetry
23.5. Surprisingly High Accuracy
23.6. Squaring Off
24. Literature References
Previous
ToC
Up
Next