This page was generated from doc/tutorials/spacetime.nblink.
[1]:
# Spacetime algebra. [1, -1, -1, -1] signature
# Make SymPy available to this program:
import sympy
from sympy import *
# Make GAlgebra available to this program:
from galgebra.ga import *
from galgebra.mv import *
from galgebra.printer import Fmt, GaPrinter, Format
# Fmt: sets the way that a multivector's basis expansion is output.
# GaPrinter: makes GA output a little more readable.
# Format: turns on latex printer.
from galgebra.gprinter import gFormat, gprint
gFormat()
$\displaystyle \DeclareMathOperator{\Tr}{Tr}$$
$$\DeclareMathOperator{\Adj}{Adj}$$
$$\newcommand{\bfrac}[2]{\displaystyle\frac{#1}{#2}}$$
$$\newcommand{\lp}{\left (}$$
$$\newcommand{\rp}{\right )}$$
$$\newcommand{\paren}[1]{\lp {#1} \rp}$$
$$\newcommand{\half}{\frac{1}{2}}$$
$$\newcommand{\llt}{\left <}$$
$$\newcommand{\rgt}{\right >}$$
$$\newcommand{\abs}[1]{\left |{#1}\right | }$$
$$\newcommand{\pdiff}[2]{\bfrac{\partial {#1}}{\partial {#2}}}$$
$$\newcommand{\npdiff}[3]{\bfrac{\partial^{#3} {#1}}{\partial {#2}^{#3}}}$$
$$\newcommand{\lbrc}{\left \{}$$
$$\newcommand{\rbrc}{\right \}}$$
$$\newcommand{\W}{\wedge}$$
$$\newcommand{\prm}[1]{{#1}^{\prime}}$$
$$\newcommand{\ddt}[1]{\bfrac{d{#1}}{dt}}$$
$$\newcommand{\R}{\dagger}$$
$$\newcommand{\deriv}[3]{\bfrac{d^{#3}#1}{d{#2}^{#3}}}$$
$$\newcommand{\grade}[2]{\left < {#1} \right >_{#2}}$$
$$\newcommand{\f}[2]{{#1}\lp {#2} \rp}$$
$$\newcommand{\eval}[2]{\left . {#1} \right |_{#2}}$$
$$\newcommand{\bs}[1]{\boldsymbol{#1}}$$
$$\newcommand{\grad}{\bs{\nabla}}$
[2]:
txyz = (t, x, y, z) = symbols('t x y z', real=True)
stcoords = (t,x,y,z) = symbols('t x y z')
st = Ga('\mathbf{e}', g=[1, -1, -1, -1], coords=stcoords)
(et, ex, ey, ez) = st.mv()
[3]:
st.mv('X', 'vector')
[3]:
$\displaystyle X = X^{t} \mathbf{\mathbf{e}_t} + X^{x} \mathbf{\mathbf{e}_x} + X^{y} \mathbf{\mathbf{e}_y} + X^{z} \mathbf{\mathbf{e}_z}$
[ ]: