## Example notebooks

The notebooks are in the Jupyter format (ipynb).
**They can be read directly in
the browser by just clicking on their titles.**

To download a notebook and run it on your computer, click on [ipynb] and type

sage -n jupyter example_file.ipynb

See also the tutorial for a basic introduction to SageManifolds (Japanese version is here).

### 2-dimensional manifolds

- Sphere S
^{2}[pdf] [ipynb] (multiple domains and charts, transition maps, scalar and vector fields, tangent spaces, curves, plot of charts and vector fields, embedding, pullback, Riemannian metric); a version using SymPy as symbolic backend, instead of SageMath default is here; a simplified version on CoCalc is here - Mercator projection and connection with torsion on S
^{2}[ipynb] (a nice example of an affine connection with non-zero torsion) - Euclidean plane E
^{2}[ipynb] [CoCalc] (Cartesian and polar coordinates, vector calculus) - Hyperbolic plane H
^{2}[pdf] [ipynb] (many charts associated with various models of H^{2}, embedding, pullback, curvature, changes of chart, graphics) - Real projective plane RP
^{2}[pdf] [ipynb] (minimal atlas with 3 charts, transition maps, differential mappings, Roman surface, Boy surface)

### 3-dimensional manifolds

- Euclidean space E
^{3}(Cartesian, spherical and cylindrical coordinates, vector calculus) - Sphere S
^{3}: charts, quaternions and Hopf fibration [ipynb] (various charts, embedding in R^{4}, maps, curves, 3D graphics) - Sphere S
^{3}: vector fields and left-invariant parallelization [ipynb] (right translations, global vector fields and global frame, link with the Hopf fibration) - Sphere S
^{3}: round metric [ipynb] (round metric as the pullback of Euclidean metric on R^{4}, Riemann tensor, volume 3-form)

### Tensor algebra

- Tensors on free modules of finite rank [pdf] [ipynb] (pure algebraic part of SageManifolds)

### Maximally symmetric spacetimes

- Minkowski spacetime [ipynb] (null coordinates, induced metric, conformal completion, Penrose diagram, embedding in the Einstein cylinder)
- Anti-de Sitter spacetime
[ipynb]
(immersion in R
^{2,3}, induced metric, curvature, geodesics, Einstein cylinder, Poincaré patch) - de Sitter spacetime [pdf] [ipynb] (map between manifolds, induced metric, curvature, maximally symmetric space)

### Black hole spacetimes

- Schwarzschild spacetime (basics) [ipynb] (Christoffel symbols, Riemann tensor, Kretschmann scalar)
- Schwarzschild spacetime [pdf] [ipynb] (Einstein equation, Bianchi identity, change of chart, change of vector frame, Kruskal-Szekeres coordinates)
- Computing a geodesic in Schwarzschild spacetime [ipynb] (numerical integration of the geodesic equation)
- More geodesics in Schwarzschild spacetime [ipynb] (numerical integration of the geodesic equation)
- Image of an accretion disk around a Schwarzschild black hole [ipynb] (numerical integration of many geodesics)
- Carter-Penrose diagram of Schwarzschild spacetime [pdf] [ipynb] (change of chart, change of vector frame)
- Kerr spacetime [pdf] [ipynb] (Killing equation, Einstein equation, Bianchi identity, Kretschmann scalar)
- Kerr-Newman spacetime [pdf] [ipynb] (Maxwell equations, Killing equation, Bianchi identity, Einstein equation, Kretschmann scalar)
- Principal null directions in Kerr spacetime [ipynb] (Weyl tensor, principal null vectors, index notations)
- Walker-Penrose Killing tensor in Kerr spacetime [ipynb] (Killing equation, principal null vectors, symmetrization, Killing tensor)
- 3+1 slicing of Kerr spacetime [pdf] [ipynb] (3-metric, lapse, shift, extrinsic curvature, 3+1 Einstein equations, electric and magnetic parts of the Weyl tensor)
- Simon-Mars tensor and Kerr spacetime [pdf] [ipynb] (Weyl tensor, self-dual Killing form, Simon-Mars tensor)
- 3+1 Simon-Mars tensor in Kerr spacetime [pdf] [ipynb] (3+1 Einstein equations, 3+1 decomposition of the Simon-Mars tensor)
- Near-horizon geometry of the extremal Kerr black hole [ipynb] (coordinate changes, tensor series expansion, Killing form)
- 5-dimensional Kerr-AdS spacetime [ipynb] (5-dimensional Einstein equation)

Other examples regarding black hole spacetimes are posted here.

Examples regarding black branes in 5-dimensional spacetimes: black branes in Lifshitz-like spacetimes and Vaidya-Lifshitz solution

### Cosmological spacetimes

- Friedmann equations [pdf] [ipynb] (FLRW metric, Einstein equation)

### Other examples in General Relativity

- Tolman-Oppenheimer-Volkoff equations [pdf] [ipynb] (Derivation of the TOV equations from the Einstein equation, numerical resolution to get models of relativistic stars)
- Lemaître-Tolman solutions [ipynb] (Solving the Einstein equation for spherically symmetric pressureless fluids)
- Curzon-Chazy spacetime: Simon-Mars tensor [pdf] [ipynb] (Weyl tensor, self-dual Killing form, Simon-Mars tensor)
- Tomimatsu-Sato spacetime: Einstein equations [pdf] [ipynb] (3+1 Einstein equations)
- Tomimatsu-Sato spacetime: Simon-Mars tensor [pdf] [ipynb] (3+1 decomposition of the Simon-Mars tensor, 2D and 3D graphics)

### Examples in solid state physics and electromagnetism

- Elasticity theory in Euclidean space (Cartesian coordinates) [pdf] [ipynb] (strain and stress tensors, Hooke's law)
- Elasticity theory in Euclidean space (spherical coordinates) [pdf] [ipynb] (strain and stress tensors, Hooke's law)
- Electromagnetism in Minkowski spacetime [ipynb] (Electromagnetic field 2-form from E and B, Maxwell equations, conserved current, Lorentz force, Poynting vector)

### Analysis on manifolds

### Submanifolds

- Foliation of Kerr spacetime by spacelike hypersurfaces [pdf] [ipynb] (intrinsic and extrinsic geometry)

See also the tutorial for a basic introduction to SageManifolds (Japanese version is here).