File doc/grg32.tex artifact b22c15a345 part of check-in fcf4221f8d


%==========================================================================%
%  GRG 3.2 Manual                           (C) 1988-97 Vadim V. Zhytnikov %
%==========================================================================%
%  LaTeX 2e and MakeIndex are required to pront this document:             %
%                                                                          %
%     latex grg32                                                          %
%     latex grg32                                                          %
%     latex grg32                                                          %
%     makeindex grg32                                                      %
%     latex grg32                                                          %
%                                                                          %
%  If you do not have MakeIndex just omit two last steps.                  %
%  The document is intended for two-side printing.                         %
%==========================================================================%

\documentclass[twoside,openright]{report}

\oddsidemargin=1.5cm
\evensidemargin=1.3cm

%%%  This is for PS fonts and dvips driver
%\usepackage{mathptm}
%\usepackage{palatino}
%\renewcommand{\bfdefault}{b}
%\newcommand{\grgtt}{\bfseries\ttfamily}
%\usepackage[dvips]{color}
%\definecolor{shade}{gray}{.9}
%\newcommand{\shadedbox}[1]{\fcolorbox{black}{shade}{#1}}
%%%  This is for CM fonts
\newcommand{\grgtt}{\ttfamily}
\renewcommand{\ttdefault}{cmtt}
\newcommand{\shadedbox}[1]{\fbox{#1}}
%%%


%\usepackage{calrsfs} % rsfs for mathcal

%%%
\makeatletter
\let\@afterindentfalse\@afterindenttrue
\@afterindenttrue
\makeatother
%%%

%%%
\usepackage{makeidx}
\makeindex
\newcommand{\cmdind}[1]{\index{Commands!\comm{#1}}\index{#1@\comm{#1} (command)}}
\newcommand{\cmdindx}[2]{\index{Commands!\comm{#1}}\index{#1@\comm{#1} (command)!\comm{#2}}}
\newcommand{\swind}[1]{\index{Switches!\comm{#1}}%
\index{#1@\comm{#1} (switch)}%
\label{#1}}
\newcommand{\swinda}[1]{\index{Switches!\comm{#1}}%
\index{#1@\comm{#1} (switch)}}
%%%

%%%
\newcommand{\rim}[1]{\stackrel{\scriptscriptstyle\{\}}{#1}\!}
%%%

%%%
\newcommand{\object}[2]{%
\begin{equation}
\mbox{\comm{#1}} =\ #2
\end{equation}}
\newcommand{\tsst}{\longleftrightarrow}
\newcommand{\vv}{\vphantom{\rule{5mm}{5mm}}}
\newcommand{\RR}[1]{\stackrel{\rm #1}{R}\!{}}
\newcommand{\OO}[1]{\stackrel{\rm #1}{\Omega}\!{}}
%%%

%%%
\newcommand{\ipr}{\rule{1.8mm}{.1mm}\rule{.1mm}{2.2mm}\,} % _| int. product
%%%

%%%
\newcommand{\spref}[1]{section \ref{#1} on page \pageref{#1}}
\newcommand{\pref}[1]{page \pageref{#1}}
%%%

%%%
\newcommand{\seethis}[1]{\marginpar{\footnotesize\it #1}}
\newcommand{\rseethis}[1]{
\reversemarginpar
\marginpar{\footnotesize\it #1}
\normalmarginpar}
\newcommand{\important}[1]{\marginpar{\itshape\bfseries\fbox{\ !\ } #1}}
%%%

%%% Footnotes simbol ...
\renewcommand{\thefootnote}{\fnsymbol{footnote}} % + ++ etc for footnotes
\makeatletter
\def\@fnsymbol#1{\ensuremath{\ifcase#1\or \dagger\or \ddagger\or
   \mathchar "278\or \mathchar "27B\or \|\or *\or **\or \dagger\dagger
   \or \ddagger\ddagger \else\@ctrerr\fi}}
\makeatother
%%%

%%% Page layout ...
\textheight=180mm
\textwidth=120mm
%\marginparsep=2mm
%\marginparwidth=28mm
\marginparsep=5mm
\marginparwidth=25mm
\parindent=6mm
\parskip=1.2mm plus 1mm minus 1mm
%%%
\newlength{\myparindent}
\myparindent=\parindent

%%% My own \tt font ...
\makeatletter
\def\verbatim@font{\grgtt}
\makeatother
\renewcommand{\tt}{\grgtt}
%%%

%%%
%%% Special symbols ...
\def\^{{\tt \char'136}}                     %%%  \^   is  ^
\def\_{{\tt \char'137}}                     %%%  \_   is  _
\newcommand{\w}{{\tt \char'057 \char'134}}  %%%  \w   is  /\
\newcommand{\bs}{{\tt \char'134}}           %%%  \bs  is  \
\newcommand{\ul}{{\tt \char'137}}           %%%  \ul  is  _
\newcommand{\dd}{{\tt \char'043}}           %%%  \dd  is  #
\newcommand{\cc}{{\tt \char'176}}           %%%  \cc  is  ~
\newcommand{\ip}{{\tt \char'137 \char'174}} %%%  \ip  is  _|
\newcommand{\ii}{{\tt \char'174}}           %%%  \ii  is  |
\newcommand{\udr}{\mbox{$\Updownarrow$}}
%%%

%%% \grg GRG logo ...
\newcommand{\grg}{{\sc GRG}}
\newcommand{\reduce}{{\sc Reduce}}
\newcommand{\maple}{{\sc Maple}}
\newcommand{\macsyma}{{\sc Macsyma}}
\newcommand{\mathematica}{{\sc Mathematica}}

%%% \marg ...
\newcommand{\marg}[1]{\marginpar{\tiny#1}}

%%% \command{...} commands in (shaded) box
\def\mynewline{\ifvmode \relax \else
               \unskip\nobreak\hfil\break\fi}
\newcommand{\command}[1]{\vspace{1.2mm}\mynewline\hspace*{6mm}%
\shadedbox{\begin{tabular}{l}\tt%
#1 \end{tabular}}\vspace{1.2mm}\newline}
%%% parts of the commands
\newcommand{\file}[1]{{\sf#1}}
\newcommand{\comm}[1]{{\upshape\tt#1}}    %  \comm  short in-line command
\newcommand{\parm}[1]{{\sf\slshape#1\/}}  %  \parm  command parameter
\newcommand{\opt}[1]{{\rm[}#1{\rm]}}      %  \opt   optional part of command
\newcommand{\user}[1]{{\bfseries\ttfamily#1}}          %  \user  user input
\newcommand{\rpt}[1]{#1{\rm[}{\tt,}#1{\rm\dots}{\rm]}} %  \rpt  repetition


\def\closerule{\rule{.1mm}{1mm}\rule{119.8mm}{.1mm}}
\def\openrule{\rule{.1mm}{1mm}\rule[1mm]{119.8mm}{.1mm}}

%%% \begin{slisting} ... \end{slisting} small font listing with frame
%%% \begin{listing} ... \end{listing} normal font listing without frame
\newcommand{\etrivlistrule}
{\vspace*{-3mm}\endtrivlist{\closerule}\newline}
\makeatletter
\newdimen\allttindent
\allttindent=0mm
\def\docspecials{\do\ \do\$\do\&%
  \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~}
\def\slisting{\vspace*{-2mm}%
\trivlist \item[]\if@minipage\else\relax\fi
\leftskip\@totalleftmargin  \advance\leftskip\allttindent \rightskip\z@
\parindent\z@\parfillskip\@flushglue\parskip\z@
\@tempswafalse\openrule \def\par{\if@tempswa\hbox{}\fi\@tempswatrue\@@par}
\obeylines \small\grgtt%
 \catcode``=13 \@noligs
\let\do\@makeother \docspecials
 \frenchspacing\@vobeyspaces}
\def\listing{\trivlist \item[]\if@minipage\else\relax\fi
\leftskip\@totalleftmargin  \advance\leftskip\allttindent \rightskip\z@
\parindent\z@\parfillskip\@flushglue\parskip\z@
\@tempswafalse \def\par{\if@tempswa\hbox{}\fi\@tempswatrue\@@par}
\obeylines \grgtt%
 \catcode``=13 \@noligs
\let\do\@makeother \docspecials
 \frenchspacing\@vobeyspaces}
\let\endslisting=\etrivlistrule
\let\endlisting=\endtrivlist
\makeatother
%%%

%%% Headings style ...
%\usepackage{fancyheadings}
%%% We just inserat the fancyheadings.sty here literally ...
\makeatletter
% fancyheadings.sty version 1.7
% Fancy headers and footers.
% Piet van Oostrum, Dept of Computer Science, University of Utrecht
% Padualaan 14, P.O. Box 80.089, 3508 TB Utrecht, The Netherlands
% Telephone: +31-30-531806. piet@cs.ruu.nl (mcvax!sun4nl!ruuinf!piet)
% Sep 16, 1994
% version 1.4: Correction for use with \reversemargin
% Sep 29, 1994:
% version 1.5: Added the \iftopfloat, \ifbotfloat and \iffloatpage commands
% Oct 4, 1994:
% version 1.6: Reset single spacing in headers/footers for use with
% setspace.sty or doublespace.sty
% Oct 4, 1994:
% version 1.7: changed \let\@mkboth\markboth to
% \def\@mkboth{\protect\markboth} to make it more robust

\def\lhead{\@ifnextchar[{\@xlhead}{\@ylhead}}
\def\@xlhead[#1]#2{\gdef\@elhead{#1}\gdef\@olhead{#2}}
\def\@ylhead#1{\gdef\@elhead{#1}\gdef\@olhead{#1}}

\def\chead{\@ifnextchar[{\@xchead}{\@ychead}}
\def\@xchead[#1]#2{\gdef\@echead{#1}\gdef\@ochead{#2}}
\def\@ychead#1{\gdef\@echead{#1}\gdef\@ochead{#1}}

\def\rhead{\@ifnextchar[{\@xrhead}{\@yrhead}}
\def\@xrhead[#1]#2{\gdef\@erhead{#1}\gdef\@orhead{#2}}
\def\@yrhead#1{\gdef\@erhead{#1}\gdef\@orhead{#1}}

\def\lfoot{\@ifnextchar[{\@xlfoot}{\@ylfoot}}
\def\@xlfoot[#1]#2{\gdef\@elfoot{#1}\gdef\@olfoot{#2}}
\def\@ylfoot#1{\gdef\@elfoot{#1}\gdef\@olfoot{#1}}

\def\cfoot{\@ifnextchar[{\@xcfoot}{\@ycfoot}}
\def\@xcfoot[#1]#2{\gdef\@ecfoot{#1}\gdef\@ocfoot{#2}}
\def\@ycfoot#1{\gdef\@ecfoot{#1}\gdef\@ocfoot{#1}}

\def\rfoot{\@ifnextchar[{\@xrfoot}{\@yrfoot}}
\def\@xrfoot[#1]#2{\gdef\@erfoot{#1}\gdef\@orfoot{#2}}
\def\@yrfoot#1{\gdef\@erfoot{#1}\gdef\@orfoot{#1}}

\newdimen\headrulewidth
\newdimen\footrulewidth
\newdimen\plainheadrulewidth
\newdimen\plainfootrulewidth
\newdimen\headwidth
\newif\if@fancyplain \@fancyplainfalse
\def\fancyplain#1#2{\if@fancyplain#1\else#2\fi}

% Command to reset various things in the headers:
% a.o.  single spacing (taken from setspace.sty)
% and the catcode of ^^M (so that epsf files in the header work if a
% verbatim crosses a page boundary)
\def\fancy@reset{\restorecr
 \def\baselinestretch{1}%
 \ifx\undefined\@newbaseline% NFSS not present; 2.09 or 2e
  \ifx\@currsize\normalsize\@normalsize\else\@currsize\fi%
 \else% NFSS (2.09) present
  \@newbaseline%
 \fi}

% Initialization of the head and foot text.

\headrulewidth 0.4pt
\footrulewidth\z@
\plainheadrulewidth\z@
\plainfootrulewidth\z@

\lhead[\fancyplain{}{\sl\rightmark}]{\fancyplain{}{\sl\leftmark}}
%  i.e. empty on ``plain'' pages \rightmark on even, \leftmark on odd pages
\chead{}
\rhead[\fancyplain{}{\sl\leftmark}]{\fancyplain{}{\sl\rightmark}}
%  i.e. empty on ``plain'' pages \leftmark on even, \rightmark on odd pages
\lfoot{}
\cfoot{\rm\thepage} % page number
\rfoot{}

% Put together a header or footer given the left, center and
% right text, fillers at left and right and a rule.
% The \lap commands put the text into an hbox of zero size,
% so overlapping text does not generate an errormessage.

\def\@fancyhead#1#2#3#4#5{#1\hbox to\headwidth{\fancy@reset\vbox{\hbox
{\rlap{\parbox[b]{\headwidth}{\raggedright#2\strut}}\hfill
\parbox[b]{\headwidth}{\centering#3\strut}\hfill
\llap{\parbox[b]{\headwidth}{\raggedleft#4\strut}}}\headrule}}#5}


\def\@fancyfoot#1#2#3#4#5{#1\hbox to\headwidth{\fancy@reset\vbox{\footrule
\hbox{\rlap{\parbox[t]{\headwidth}{\raggedright#2\strut}}\hfill
\parbox[t]{\headwidth}{\centering#3\strut}\hfill
\llap{\parbox[t]{\headwidth}{\raggedleft#4\strut}}}}}#5}

\def\headrule{{\if@fancyplain\headrulewidth\plainheadrulewidth\fi
\hrule\@height\headrulewidth\@width\headwidth \vskip-\headrulewidth}}

\def\footrule{{\if@fancyplain\footrulewidth\plainfootrulewidth\fi
\vskip-0.3\normalbaselineskip\vskip-\footrulewidth
\hrule\@width\headwidth\@height\footrulewidth\vskip0.3\normalbaselineskip}}

\def\ps@fancy{
\def\@mkboth{\protect\markboth}
\@ifundefined{chapter}{\def\sectionmark##1{\markboth
{\uppercase{\ifnum \c@secnumdepth>\z@
 \thesection\hskip 1em\relax \fi ##1}}{}}
\def\subsectionmark##1{\markright {\ifnum \c@secnumdepth >\@ne
 \thesubsection\hskip 1em\relax \fi ##1}}}
{\def\chaptermark##1{\markboth {\uppercase{\ifnum \c@secnumdepth>\m@ne
 \@chapapp\ \thechapter. \ \fi ##1}}{}}
\def\sectionmark##1{\markright{\uppercase{\ifnum \c@secnumdepth >\z@
 \thesection. \ \fi ##1}}}}
\ps@@fancy
\global\let\ps@fancy\ps@@fancy
\headwidth\textwidth}
\def\ps@fancyplain{\ps@fancy \let\ps@plain\ps@plain@fancy}
\def\ps@plain@fancy{\@fancyplaintrue\ps@@fancy}
\def\ps@@fancy{
\def\@oddhead{\@fancyhead\@lodd\@olhead\@ochead\@orhead\@rodd}
\def\@oddfoot{\@fancyfoot\@lodd\@olfoot\@ocfoot\@orfoot\@rodd}
\def\@evenhead{\@fancyhead\@rodd\@elhead\@echead\@erhead\@lodd}
\def\@evenfoot{\@fancyfoot\@rodd\@elfoot\@ecfoot\@erfoot\@lodd}
}
\def\@lodd{\if@reversemargin\hss\else\relax\fi}
\def\@rodd{\if@reversemargin\relax\else\hss\fi}

\let\latex@makecol\@makecol
\def\@makecol{\let\topfloat\@toplist\let\botfloat\@botlist\latex@makecol}
\def\iftopfloat#1#2{\ifx\topfloat\empty #2\else #1\fi}
\def\ifbotfloat#1#2{\ifx\botfloat\empty #2\else #1\fi}
\def\iffloatpage#1#2{\if@fcolmade #1\else #2\fi}
\makeatother
%%%
\pagestyle{fancy}
\addtolength{\headwidth}{\marginparsep}
\addtolength{\headwidth}{\marginparwidth}
\lhead[\bfseries\thepage]{\bfseries\slshape\rightmark}
\chead{}
\rhead[\bfseries\slshape\leftmark]{\bfseries\thepage}
\lfoot{}
\cfoot{}
\rfoot{}
\renewcommand{\uppercase}[1]{#1}
%%%

%%% Chapter style ...
\makeatletter
\def\@makechapterhead#1{%
  \noindent\grgrule\break%
  { \hsize=150mm
    \parindent \z@ \raggedleft \reset@font
    \ifnum \c@secnumdepth >\m@ne
         \Large\slshape \@chapapp{} \Huge\bfseries \thechapter
         \par
         \vskip 20\p@
       \fi
    \Huge \bfseries\upshape #1\par
    \nobreak
    \vskip 40\p@
  }}
\def\@makeschapterhead#1{%
  \noindent\grgrule\break%
  { \hsize=150mm
   \parindent \z@ \raggedleft
    \reset@font
    \Large\slshape  #1\par
    \nobreak
    \vskip 20\p@
  }}
\renewcommand\chapter{\if@openright\cleardoublepage\else\clearpage\fi
                    \thispagestyle{empty}%
                    \global\@topnum\z@
                    %\@afterindentfalse
                    \secdef\@chapter\@schapter}
\makeatother
\renewcommand{\chaptername}{CHAPTER}
\renewcommand{\contentsname}{CONTENTS}
\renewcommand{\appendixname}{APPENDIX}
\newcommand{\grgrule}{\rule{150mm}{.3mm}\relax}
%%%

%%% Sections ...
%\renewcommand{\thesection}{}
%\renewcommand{\thesubsection}{}
%\renewcommand{\thesubsubsection}{}
\makeatletter
%\renewcommand\section{\@startsection {section}{1}{\z@}%
%                                   {-3.5ex \@plus -1ex \@minus -.2ex}%
%                                   {2.3ex \@plus.2ex}%
%                                   {\normalfont\Large\bfseries}}
\renewcommand\subsection{\@startsection{subsection}{2}{\z@}%
                                     {-3.25ex\@plus -1ex \@minus -.2ex}%
                                     {1.5ex \@plus .2ex}%
                                     {\normalfont\large\slshape\bfseries}}
%\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
%                                     {-3.25ex\@plus -1ex \@minus -.2ex}%
%                                     {1.5ex \@plus .2ex}%
%                                     {\normalfont\normalsize\bfseries}}
\makeatother
%%%



\begin{document}


\begin{titlepage}
\hsize=150mm
\hrulefill
\vspace*{20mm}
\begin{center}
\Huge\bf GRG\\[1mm]
\normalsize Version 3.2
\end{center}
\begin{center}
\Large Computer Algebra System for\\
Differential Geometry,\\
Gravitation and \\
Field Theory
\vspace*{25mm}\\
{\Large\itshape\bfseries Vadim V. Zhytnikov}\\
\vfill
{\normalsize Moscow, 1992--1997 $\bullet$ Chung-Li, 1994}
\end{center}
\hrulefill
\end{titlepage}
\setcounter{page}{0}\thispagestyle{empty}

\tableofcontents\thispagestyle{empty}

\chapter{Introduction}

Calculation of various geometrical and physical quantities and
equations is the usual technical problem which permanently arises
in geometry, field and gravity theory. Numerous indices,
contractions and components make these calculations very tedious
and error-prone. Since this calculus obeys the well defined rules the idea
to automate this kind of problems using computer is quite
natural. Now there are several computer algebra systems such as
\maple, \reduce, \mathematica\ or \macsyma\ which in principle
allow one to do this and it is not so hard
to write a program to calculate, for example, the
curvature tensor or connection. But suppose that we want to
make a non-trivial coordinate transformation or tetrad rotation,
calculate covariant or Lie derivative, compute a complicated
expression with numerous contraction or raise or lower some indices.
All these operations are typical in differential geometry
and field theory but their realization with the help of general
purpose computer algebra systems requires hard programming since
all these systems really know nothing about \emph{covariant properties}
of geometrical quantities.

The computer algebra system \grg\ is designed in such a way
to make calculation in differential geometry and field theory
as simple and natural as possible. \grg\ is based on the
computer algebra system \reduce\ but \grg\ has its own simple
input language whose commands resembles English phrases.
Working with \grg\ no any knowledge of programming is required.

\grg\ understands tensors, spinors, vectors, differential forms
and knows all standard operations with these quantities.
Input form for mathematical expressions is very close
to traditional mathematical notation including Einstein summation
rule. \grg\ knows the covariant properties of
these objects, you can easily raise and lower indices,
compute covariant and Lie derivatives, perform
coordinate and frame transformations.
\grg\ works in any dimension and allows one to represent tensor
quantities with respect to holonomic, orthogonal and even
any other arbitrary frame.

One of the useful features of \grg\ is that it has a large
number of built-in standard field-theory
and geometrical quantities and formulas for their computation.
Thus \grg\ provides ready solutions to many standard problems.

Another unique feature of \grg\ is that it can export
results of calculations into other computer algebra system.
You can save your data in to the file in the format of
\maple, \mathematica, \macsyma\ or \reduce\ in order to use
this system to proceed analysis of the data.
The \LaTeX\ output format is supported as well.
In addition \grg\ is compatible with \reduce\ graphics
shells providing niece book-quality output with Greek letters,
integral signs etc.

The main built-in \grg\ capabilities are:
\begin{list}{$\bullet$}{\labelwidth=8mm\leftmargin=10mm}
\item  Connection, torsion and nonmetricity.
\item  Curvature.
\item  Spinorial formalism.
\item  Irreducible decomposition of the curvature, torsion, and
       nonmetricity in any dimension.
\item  Einstein equations.
\item  Scalar field with minimal and non-minimal interaction.
\item  Electromagnetic field.
\item  Yang-Mills field.
\item  Dirac spinor field.
\item  Geodesic equation.
\item  Null congruences and optical scalars.
\item  Kinematics for time-like congruences.
\item  Ideal and spin fluid.
\item  Newman-Penrose formalism.
\item  Gravitational equations for the theory with arbitrary
       gravitational Lagrangian in Riemann and Riemann-Cartan
       spaces.
\end{list}

I would like to stress that current \grg\ version is
intended for calculations in a concrete coordinate map only.
It cannot operate with tensors as with objects having
abstract symbolic indices.

This book consist of two main parts. First part
contains detailed description of \grg\ as a programming
system. Second part describes all built-in objects
and formulas for their computation.


\chapter{Programming in \grg}

Throughout the chapter \comm{commands} are printed in
typewriter font. The slanted serif-less font is
used for command \parm{parameters}.
The optional parts of the commands are enclosed in
squared brackets \opt{option} and \rpt{\parm{id}}
stands for one or several repetitions of \parm{id}:
\parm{id} or \comm{\parm{id},\parm{id}} etc.
Examples are separated form the text by horizontal lines
$\stackrel{\rule{0.1mm}{1mm}\rule[1mm]{3mm}{0.1mm}}
{\rule{0.1mm}{1mm}\rule{3mm}{0.1mm}}$ and the user input
can be easily distinguished from the \grg\ output by the prompt
\comm{<-} which precedes every input line.


\section{Session, Tasks and Commands}

To start \grg\ it is necessary to start \reduce\  and
\seethis{
On some systems you have
to use {\tt\upshape load!\_package grg;}\newline since
{\tt\upshape load} is not defined.\newline
\newline
Sometimes it\newline is better to use two commands\newline
{\tt\upshape load grg32;  grg;}\newline
or\newline
{\tt\upshape load grg;  grg;}\newline
(See section \ref{configsect} for details.)}
enter the command {\tt load grg;}

\begin{slisting}
REDUCE 3.5, 15 Oct 93, patched to 15 Jun 95 ...

1: load grg;

This is GRG 3.2 release 2 (Feb 9, 1997) ...

System directory: c:{\bs}reduce{\bs}grg32{\bs}
System variables are upper-cased: E I PI SIN ...
Dimension is 4 with Signature (-,+,+,+)

<-
\end{slisting}
Symbol \comm{<-} is the \grg\ prompt which shows that
now \grg\ waits for your input. The \grg\ \emph{task} (we prefer
this term instead of usual \emph{program}) consist of the
sequence of commands terminated by semicolon \comm{;}.
Reading the input \grg\ splits it on \emph{atoms}.
There are several types of atoms:\index{Atoms}
\begin{list}{$\bullet$}{\labelwidth=4mm\leftmargin=\parindent}
\item The identifier or symbol is a sequence of letters and digits
starting with a letter:
\begin{verbatim}
       i   I   alpha1   beta   ABC123D   Find
\end{verbatim}
The identifiers in \grg\ may have trailing tilde character \cc.
Any other character may be incorporated in the identifier if
preceded by the exclamation sign:\index{Identifiers}
\begin{verbatim}
        beta~   LIMIT!+
\end{verbatim}
The identifiers in \grg\ play the role of the variables and
functions in mathematical expressions and words in commands.

\item Integer numbers\index{Numbers}
\begin{verbatim}
        0   123   104341
\end{verbatim}

\item String is a sequence of characters enclosed in double quotes\index{Strings}
\begin{verbatim}
        "file.txt"   "This is a string"    "dir *.doc"
\end{verbatim}
The strings in \grg\ are used for file names and operating system
commands.

\item Nine special two-character atoms
\begin{verbatim}
       **   _|   /\   |=   ~~   ..   <=   >=   ->
\end{verbatim}

\item Any other characters are considered as single-character atoms.
\end{list}

The format of \grg\ commands is free. They can span one or several lines
and any number of spaces and tabulations can be inserted between two
neighbor atoms.

\enlargethispage{3mm}

The \grg\ session may consist of several independent tasks.
The command\index{Tasks}\cmdind{Quit}
\command{Quit;}
terminates both \grg\ and \reduce\ session and returns the control
to the operating system level. The command\cmdind{Stop}
\command{Stop;}
terminates current \grg\ task and brings
the session control menu:\index{Session control menu}
 \begin{slisting}
<- Stop;

    Quit GRG       - 0
    Start Task     - 1
    Exit to REDUCE - 2

  Type 0, 1 or 2:
\end{slisting}
\newpage

\noindent
The option \comm{0} terminates \reduce\ session similarly to the
command \comm{Quit;}.
The choice \comm{1} starts new task by bringing
\grg\ to its initial state: all variables, declarations, substitutions
and results of calculations are cleared and all switches
resume their initial positions.\footnote{Usually
\grg\ does good job by resuming initial state and new task
turns out to be independent of previous ones. But on some
rare occasions the initial state cannot be completely recovered
and it is better to restart \reduce\ and \grg\ completely.}
Finally the option \comm{2} terminates \grg\ task and returns
control to the \reduce\ command level. In this case \grg\ can be
restarted later by the command \comm{grg;}.

The commands in \grg\ are case insensitive, i.e. command
\comm{Quit;} is equivalent to \comm{quit;} and \comm{QUIT;} etc.
But notice that unlike \reduce\ variables and functions in
mathematical expressions in \grg\ \emph{are case sensitive}.


\subsection{Switches}
\index{Switches}

Switches in \grg\ and \reduce\ are used to control various
system modes of operation. They are denoted by identifiers and
the commands\cmdind{On}\cmdind{Off}
\command{On \rpt{\parm{switch}};\\\tt
Off \rpt{\parm{switch}};}
turns the \parm{switch} on and off respectively.
Any switch defined by \reduce\ is available in \grg\ as well.
In addition \grg\ defines a couple of its own switches.
The full list of \grg\ switches is presented in appendix A.
The command\cmdind{Show Switch}\cmdind{Switch}
\command{\opt{Show} Switch \parm{switch};}
or equivalently
\command{Show \parm{switch};\\\tt
?~\parm{switch};}
prints current \parm{switch} position
\begin{slisting}
<- Show Switch TORSION;
TORSION is Off.
<- On torsion,gcd;
<- switch torsion;
TORSION is On.
<- switch exp;
GCD is On
\end{slisting}
Switches in \grg\ are case insensitive.

\subsection{Batch File Execution}

Usually \grg\ works in the interactive mode which
is not always convenient. The command\cmdind{Input}\index{Batch file execution}
\command{\opt{Input} "\parm{file}";}
reads the \parm{file} and executes commands stored in it.
The file names in \grg\ are always denoted by strings and exact
specification of \parm{file} is operating system dependent.
The word \comm{Input} is optional, thus in order to run batch
file it suffices to enter its name \comm{"\parm{file}";}.
The execution of batch file commands can be suspended by the
command\cmdind{Pause}
\command{Pause;}
After this command \grg\ enters the interactive mode.
One can enter one or several commands interactively and then
resume batch file execution by the command\cmdind{Next}
\command{Next;}

In general no any special end-of-file symbol or command
is required in the \grg\ batch \parm{file} but is necessary
the symbol\index{end-of-file symbol \comm{\$}}
\comm{\$} is recognized by \grg\ as the end-of-file mark.

If during the batch file execution an error occurs
\grg\ enter interactive mode and ask user
to input the command which is supposed to replace the
erroneous one. After the receiving of \emph{one} command
\grg\ automatically resumes the batch file execution.
The command \comm{Pause;} can be used if it is necessary
to execute \emph{several} commands instead of one.

The command\cmdind{Output}
\command{Output "\parm{outfile}";}
redirects all \grg\ output into the \parm{outfile}.
The \parm{outfile} can be closed by the equivalent commands
\cmdind{EndO}\cmdind{End of Output}
\command{EndO;\\\tt
End of Output;}

It is convenient to run long-time \grg\ tasks in background.
The way of doing this depend on the operating system.
For example to execute \grg\ task in background in UNIX it is
necessary to use the following command
\begin{listing}
   reduce < task.grg > grg.out &
\end{listing}
Here we assume that the \reduce\ invoking command is \comm{reduce}
and the file \comm{task.grg} contains the \grg\ task commands:
\begin{listing}
   load grg;
   \parm{grg command};
   \parm{grg command};
   ...
   \parm{grg command};
   quit;
\end{listing}
The output of the session will be written into the file \file{grg.out}.

Since no proper reaction on errors is possible during the
background execution it is good idea to turn the switch
\comm{BATCH} on.\swind{BATCH} This makes \grg\ to terminate
the session immediately in the case of any error.

\subsection{Operating System Commands}

The command\cmdind{System}
\command{System "\parm{command}";}
executes the operating system \parm{command}.
The same command without parameters
\command{System;}
temporary suspends \grg\ session and passes the control to the
operating system command level. The details may depend
on the concrete operating system. In particular in UNIX
the command \comm{system;} may fail but UNIX has some
general mechanism for suspending running programs:
you can press \comm{\^Z} to suspend any program and \comm{\%+}
to resume its execution.


\subsection{Comments}

%\reversemarginpar

The comment commands\cmdind{Comment}
\command{Comment \parm{any text};\\\tt
\% \parm{any text};}
are used to supply additional information to \grg\ tasks
\seethis{See page \pageref{Unload} about the \comm{Unload} command.}
and data saved by the \comm{Unload} command.
The comment can be also attached to the end of any \grg\ command
\command{\parm{grg command} \% \parm{any text};}

%\normalmarginpar

\subsection{Timing}

The command \cmdind{Time}\cmdind{Show Time}
\command{\opt{Show} Time;}
prints time elapsed since the beginning of current \grg\ task
including the percentage of so called garbage collections.
The garbage collection time can be also printed by the
command \cmdind{GC Time}\cmdind{Show GC Time}
\command{\opt{Show} GC Time;}

If percentage of garbage collections grows and
exceeds say 30\% then memory of your system
is running short and you probably need more RAM.


\section{Declarations}

Any object, variable or function in \grg\  must be declared.
This allows to locate misprints and makes the system more
reliable. Since \grg\ always work in some concrete
coordinate system (map) the coordinate declaration is the
most important one and must be present in every \grg\ task.

\subsection{Dimension and Signature}

During installation \grg\ always defines default value of
the dimension and signature.\index{Dimension!default}\index{Signature!default}
\seethis{See \pref{tuning}
to find out how to change the default dimension and signature.}
The information about this default value is printed\index{Dimension}\index{Signature}
upon \grg\ start in the form of the following (or similar) message line:
\begin{slisting}
Dimension is 4 with Signature (-,+,+,+)
\end{slisting}


The following command overrides the default dimension and signature\cmdind{Dimension}
\command{Dimension \parm{dim} with \opt{Signature} (\rpt{\parm{pm}});}
where \parm{dim} is the number \comm{2} or greater and \parm{pm}
is \comm{+} or \comm{-}. The \parm{pm} can be preceded or succeeded by
a number which denotes several repetitions of this \parm{pm}.
For example the declarations
\begin{listing}
   Dimension 5 with Signature (+,+,-,-,-);
   Dimension 5 with (2+,-3);
\end{listing}
are equivalent and defines 5-dimensional space with the
signature ${\rm diag}{\scriptstyle(+1,+1,-1,}$ ${\scriptstyle-1,-1)}$.

The important point is that the dimension declaration must
be \emph{very first in the task} and goes before any other command.
Current dimension and signature can be printed by the command
\cmdind{Status}\cmdind{Show Status}
\command{\opt{Show} Status;}



\subsection{Coordinates}

The coordinate declaration command must be present in every
\grg\ task\cmdind{Coordinates}
\command{Coordinates \rpt{\parm{id}};}
Only few commands such as informational commands, other declarations,
switch changing commands may precede the coordinate declaration.
The only way to have a tusk without the coordinate declaration is
to load the file where coordinates where saved by the
\comm{Unload} command.\seethis{See \pref{UnloadLoad}
to find out how to save data and declarations into a file.}
but no any computation can be done before coordinates are
declared. Current coordinate list can be printed by the command\cmdindx{Write}{Coordinates}
\command{Write Coordinates;}


\begin{table}
\begin{center}\index{Constants!predefined}
\begin{tabular}{|l|l|}
\hline
\tt  E I PI INFINITY     & Mathematical constants $e,i,\pi$,$\infty$    \\
\hline
\tt  FAILED              &                                             \\
\hline
\tt  ECONST              & Charge of the electron                      \\
\tt  DMASS               & Dirac field mass                            \\
\tt  SMASS               & Scalar field mass                           \\
\hline
\tt  GCONST              & Gravitational constant                      \\
\tt  CCONST              & Cosmological constants                      \\
\hline
\tt  LC0 LC1 LC2 LC3     & Parameters of the quadratic                 \\
\tt  LC4 LC5 LC6         & gravitational Lagrangian                    \\
\tt  MC1 MC2 MC3         &                                             \\
\hline
\tt  AC0                 & Nonminimal interaction constant             \\
\hline
\end{tabular}
\caption{Predefined constants}\label{predefconstants}
\end{center}
\end{table}


\subsection{Constants}
\index{Constants}

Any constant must be declared by the command\cmdind{Constants}
\command{Constants \rpt{\parm{id}};}
The list of currently declared constants can be printed
by the command\cmdindx{Write}{Constants}
\command{Write Constants;}
There are also a number of built-in constants
which are listed in table \ref{predefconstants}.

\subsection{Functions}

Functions in \grg\ are the analogues of the \reduce\ \emph{operators}
but we prefer to use this traditional mathematical term.
The function must be declared by the command\cmdind{Functions}
\command{Functions \rpt{\parm{f}\opt{(\rpt{\parm{x}})}};}
Here \parm{f} is the function identifier. The optional list
of parameters \parm{x} defines function with \emph{implicit}
dependence. The \parm{x} must be either coordinate or constant.
The construction \comm{\parm{f}(*)} is a shortcut which
declares the function \parm{f} depending on \emph{all coordinates}.

The following example declares three functions
\comm{fun1}, \comm{fun2} and \comm{fun3}.
The function \comm{fun1}, which was declared without implicit
coordinate list, must be always used in mathematical expressions
together with the explicit arguments like \comm{fun1(x+y)} etc.
The functions \comm{fun2} and \comm{fun3} can appear
in expressions in similar fashion but also as a single symbol
\comm{fun2} or \comm{fun3}
\begin{slisting}
<- Coordinates t, x, y, z;
<- Constant a;
<- Functions fun1, fun2(x,y), fun3(*);
<- Write functions;
Functions:

fun1 fun2(x,y) fun3(t,x,y,z)

<- d fun1(x+a);

DF(fun1(a + x),x) d x

<- d fun2;

DF(fun2,x) d x + DF(fun2,y) d y

<- d fun3;

DF(fun3,t) d t + DF(fun3,x) d x + DF(fun3,y) d y + DF(fun3,z) d z
\end{slisting}

The functions may have particular properties with respect
to their arguments permutation and sign. The corresponding
declarations are\cmdind{Symmetric}\cmdind{Antisymmetric}\cmdind{Odd}\cmdind{Even}
\command{Symmetric \rpt{\parm{f}};\\\tt
Antisymmetric \rpt{\parm{f}};\\\tt
Odd \rpt{\parm{f}};\\\tt
Even \rpt{\parm{f}};}
Notice that these commands are valid only after function \parm{f}
was declared by the command \comm{Function}.

In addition to user-defined there is also large number of
functions predefined in \reduce. All these functions can be
used in \grg\ without declaration. The complete list of these
functions depends on \reduce\ versions.
Any function defined in the \reduce\ package (module)
is available too if the package is loaded before \grg\ was
started or during \grg\ session.\seethis{See \pref{packages}
to find out how to load the \reduce\ packages.}
For example the package \file{specfn} contains definitions
for various special functions.

Finally there is also special declaration \cmdind{Generic Functions}
\command{Generic Functions \rpt{\parm{f}(\rpt{\parm{a}})};}
This command is valid iff the package \file{dfpart.red} is
installed on your \reduce\ system. Here unlike the usual
function declaration the list of parameters must be always
present and \parm{a} can be any identifier preferably
distinct from any other variable.
\seethis{See \pref{genfun} to find out about the generic functions.}
The role of \parm{a} is also completely different and is explained later.

The list of declared functions can be printed by the command
\cmdindx{Write}{Functions}
\command{Write Functions;}
Generic functions in this output are marked by the label \comm{*}.

\subsection{Affine Parameter}

The variable which plays the role of affine parameter
in the geodesic equation must be declared by the command \label{affpar}
\command{Affine Parameter \parm{s};}
and can be printed by the command\cmdindx{Write}{Affine Parameter}
\command{Write Affine Parameter;}

\vfill
\newpage

\subsection{Case Sensitivity}
\label{case}

Usually \reduce\ is case insensitive which means for example
that expression \comm{x-X} will be evaluated by \reduce\ as zero.
On the contrary all coordinates, constants and functions in \grg\ are
case sensitive, e.g. \comm{alpha}, \comm{Alpha} and \comm{ALPHA}
are all different. Notice that commands and switches in \grg\
3.2 remain case insensitive.
\index{Internal \reduce\ case}

Therefore all predefined by \grg\ constants and
all built-in objects must be used exactly as they
presented in this manual \comm{GCONST}, \comm{SMASS} etc.
The situation with the constants and functions which predefined
by \reduce\ is different. The point is that in spite of its default
case insensitivity internally \reduce\ converts everything
into some default case which may be upper or lower.
Therefore depending on the particular \reduce\ system they
must be typed either as
\begin{listing}
   E   I   PI   INFINITY   SIN   COS   ATAN
\end{listing}
or in lower case
\begin{listing}
   e   i   pi   infinity   sin   cos   atan
\end{listing}
For the sake of definiteness throughout this book we chose
the first upper case convention.

When \grg\ starts it informs you about internal case of
your particular \reduce\ system by printing the message
\begin{slisting}
System variables are upper-cased: E I PI SIN ...
\end{slisting}
or
\begin{slisting}
System variables are lower-cased: e i pi sin ...
\end{slisting}
You can find out about the internal case
using the command\cmdind{Status}\cmdind{Show Status}
\command{\opt{Show} Status;}

\vfill
\newpage


\subsection{Complex Conjugation}

By default all variables and functions in \grg\ are considered to be
real excluding the imaginary unit constant \comm{I} (or \comm{i} as
explained above). But if two identifiers differ only by the trailing
character \comm{\cc} they are considered as a pair of
complex variables which are conjugated to each other.
In the following example coordinates
\comm{z} and \comm{z\cc} comprise such a pair:
\begin{slisting}
<- Coordinates u, v, z, z~;

z & z~ - conjugated pair.

<- Re(z);

 z + z~
--------
   2

<- Im(z~);

 I*(z - z~)
------------
     2
\end{slisting}



\section{Objects}

Objects play a fundamental role in \grg. They represent
mathematical quantities such as metric, connection, curvature
and any other spinor or tensor geometrical and physical fields
and equations. \grg\ has quite large number of built-in
objects and knows many formulas for their calculation.
But you are not obliged to use the built-in quantities
and can declare your own. The purpose of the declaration is
to tell \grg\ basic properties of a new quantity.


\subsection{Built-in Objects}

\noindent
An object is characterized by the following properties and attributes:
\index{Built-in objects}
\begin{list}{$\bullet$}{\labelwidth=4mm\leftmargin=\parindent\parsep=0mm}
\item Name
\item Identifier or symbol
\item Type of the component
\item List of indices
\item Symmetries with respect to index permutation
\item Density and pseudo-tensor property
\item Built-in ways of calculation
\item Value
\end{list}

The object \emph{name} is a sequence of words which are
usually the common English name of corresponding quantity.
The name is case insensitive and is used to denote
a particular object in commands.
So called \emph{group names}\index{Group names}
refer to a collection of closely related objects. In particular
the name {\tt Curvature Spinors} (see page \pageref{curspincoll})
refers to the irreducible components of the curvature tensor in
spinorial representation.
Actual content of the group may depend on the environment.
In particular the group {\tt Curvature Spinors} includes
three objects in the Riemann space (Weyl spinor, traceless
Ricci spinor and scalar curvature) while in the space with
torsion we have six irreducible curvature spinors.

The object \emph{identifier} or \emph{symbol} is an identifier
which denotes the object in mathematical expressions. Object
symbols are case sensitive.

The object \emph{type} is the type of its component: objects can be
scalar, vector or $p$-form valued. The \emph{density} and
\emph{pseudo-tensor} properties of the object characterizes its
behaviour under coordinate and frame transformations.

Objects can have the following types of indices:
\begin{list}{$\bullet$}{\labelwidth=4mm\leftmargin=\parindent}
\item Upper and lower holonomic coordinate indices.
\item Upper and lower frame indices.
\item Upper and lower spinorial indices.
\item Upper and lower conjugated spinorial indices.
\item Enumerating indices.
\end{list}
The major part of \grg\ built-in objects has frame indices.
\seethis{See page \pageref{metric} about the frame in \grg.}
The frame in \grg\ can be arbitrary but you can easily specify
the frame to be holonomic or say orthogonal. Then built-in
object indices become holonomic or orthogonal respectively.

\grg\ deals only with the SL(2,C) spinors which are restricted
to the 4-dimensional spaces of Lorentzian signature.
\seethis{See \pref{spinors} about the spinorial formalism in \grg.}
The corresponding SL(2,C) indices take values 0 and 1.
The conjugated indices are transformed with the help
of the complex conjugated SL(2,C) matrix.
If some spinor is totally symmetric in the group of $n$ spinorial
indices (irreducible spinor) then these indices can be
replaced by a single so called \emph{summed spinorial index}
of rank $n$ which take values from 0 to $n$.
The summed spinorial indices provide the most economic
way to store the irreducible spinor components.

Enumerating indices just label a collection of
values and have no any covariant meaning. Accordingly there is
no difference between upper and lower enumerating indices.

Notice that an index of any type in \grg\ always runs from
0 up to some maximal value which depend on the index type
and dimensionality: $d-1$ for frame and coordinate indices,\index{Dimension}
and $n$ the spinor indices of the rank $n$.

\grg\ understands various types of index symmetries:
symmetry, antisymmetry, cyclic symmetry and Hermitian
symmetry. These symmetries can apply not only to single
indices but to any group of indices as well.
\index{Index symmetries}\index{Canonical order of indices}
\grg\ uses object symmetries to decrease the amount of memory
required to store the object components. It stores only components
with the indices in certain \emph{canonical} order
and any other component are automatically
restored if necessary by appropriate index permutation.
The canonical order of indices is defined as follows:
for symmetry, antisymmetry or Hermitian symmetry indices
are sorted in such a way that index values grows from
left to the right. For cyclic symmetry indices are shifted to
minimize the numerical value of the whole list of indices.

Finally there are two special types of objects: equations
and connection 1-forms.
\index{Equations}
Equations have all the same properties as any
other object but in addition they have left and right hand side
and are printed in the form of equalities.
The connections are used by \grg\ to construct covariant derivatives.
\index{Connections}\seethis{See \pref{conn2} about the connections.}
There are only four types of connections: holonomic
connection 1-form, frame connection 1-form, spinor connection
1-form and conjugated spinor connection 1-form.

Almost all built-in objects have associated built-in \emph{ways of
calculation} (one or several).
\index{Ways of calculation}
Each way is nothing but a formula which can be used
to obtain the object value.

Every object can be in two states. Initially when \grg\ starts
all objects are in \emph{indefinite} state, i.e. nothing is known
about their value. \index{Object value}
Since \grg\ always works in some concrete frame and coordinate
system the object value is a table of the components.
As soon as the value of certain object
is obtained either by direct assignment or using some built-in
formula (way of calculation) \grg\ remember this value
and store it in some internal table. Later this value
can be printed, re-evaluated used in expression etc.
The object can be returned to its initial indefinite state
using the command \comm{Erase}.\cmdind{Erase}
\grg\ uses object symmetries to reduce total number of
components to store.

The complete list of built-in \grg\ objects is given in
appendix C. The chapter 3 also describes built-in objects
but in the usual mathematical style. The equivalent commands
\cmdind{Show \parm{object}}
\command{Show \parm{object};\\\tt%
?~\parm{object};}
prints detailed information about the object \parm{object}
including object name, identifier, list of indices,
type of the component, current state (is the value of an
object known or not), symmetries  and ways of calculation.
Here \parm{object} is either object name or its identifier.

The command\cmdind{Show *}
\command{Show *;}
prints complete list of built-in object names. This list
is quite long and the command
\command{Show \parm{c}*;}
gives list of objects whose names begin with the character
\parm{c} (\comm{a}--\comm{z}).

Finally the command \cmdind{Show All}
\command{Show All;}
prints list of objects whose values are currently known.

Notice that some built-in objects has limited scope.
In particular some objects exists only in certain dimensionality,
the quantities which are specific to spaces with torsion
are defined iff switch \comm{TORSION} is turned on etc.

Let us consider some examples. We begin with the
curvature tensor $R^a{}_{bcd}$
\begin{slisting}
<- Show Riemann Tensor;

Riemann tensor RIM'a.b.c.d is Scalar
  Value: unknown
  Symmetries: a(3,4)
  Ways of calculation:
    Standard way (D,OMEGA)
\end{slisting}
This object has name {\tt Riemann Tensor} and identifier
{\tt RIM}. The object is {\tt Scalar} (0-form) valued and
has four frame indices. Frame indices are denoted by the
lower-case characters and their upper or lower position
are denoted by \comm{'} or \comm{.} respectively.
The Riemann tensor is antisymmetric in two last indices
which is denoted by \comm{a(3,4)}.

The curvature 2-form $\Omega^a{}_b$
\begin{slisting}
<- ? OMEGA;

Curvature OMEGA'e.f is 2-form
  Value: unknown
  Ways of calculation:
    Standard way (omega)
    From spinorial curvature (OMEGAU*,OMEGAD)
\end{slisting}
has name {\tt Curvature} and the identifier {\tt OMEGA}
and is 2-form valued.

The traceless Ricci spinor (the quantity which is usually
denoted in the Newman-Penrose formalism as $\Phi_{AB\dot{C}\dot{D}}$)
\begin{slisting}
<- ? Traceless Ricci Spinor;

Traceless ricci spinor RC.AB.CD~ is Scalar
  Value: unknown
  Symmetries: h(1,2)
  Ways of calculation:
    From spinor curvature (OMEGAU,SD,VOL)
\end{slisting}
Spinorial indices
are denoted by upper case characters with the trailing \comm{\cc}
for conjugated indices. Usual spinorial indices are denoted
by a \emph{single} upper case letter while summed indices
are denoted by several characters. Thus, the traceless Ricci
spinor has two summed spinorial indices
of rank 2 each taking the values from 0 to 2. The spinor
is hermitian \comm{h(1,2)}.

The Einstein equation is an example of equation
\begin{slisting}
<- ? Einstein Equation;

Einstein equation EEq.g.h is Scalar Equation
  Value: unknown
  Symmetries: s(1,2)
  Ways of calculation:
    Standard way (G,RIC,RR,TENMOM)
\end{slisting}
and 1-form $\Gamma^\alpha{}_\beta$ is an example of the connection \enlargethispage{2mm}
\begin{slisting}
<- Show Holonomic Connection;

\reversemarginpar

Holonomic connection GAMMA^x_y is 1-form Holonomic Connection
  Value: unknown
  Ways of calculation:
    From frame connection (T,D,omega)
\end{slisting}
The coordinate indices are denoted by the lower-case
letters with labels \comm{\^} and \comm{\_} denoting
upper and lower index position respectively.
Notice that above the first ``{\tt Holonomic connection}'' is the
name of the object while second ``{\tt  Holonomic Connection}''
means that \grg\ recognizes it as the connection and will
use \comm{GAMMA} to  construct covariant derivatives for quantities
having the coordinate indices. \seethis{See \pref{cder} about the covariant derivatives.}
You can define any number of other holonomic
connections and use them in the covariant derivatives
on the equal footing with the built-in object \comm{GAMMA}.

\normalmarginpar

The notation in which command \comm{Show} prints
information about a particular object is the same as in the
new object declaration and is explained in details below.


\subsection{Macro Objects}
\index{Macro Objects}\label{macro}

There is also another class of built-in objects which are
called \emph{macro objects}. The main difference between the
usual and macro objects is that macro quantities has no
permanent storage to their components instead they are calculated
dynamically only when its component is required in some expression.
In addition
they do not have names and are denoted only by the identifier only.
Usually macro objects play auxiliary role. The complete
list of macro objects can be found in appendix B.

The example of macro objects are the Christoffel symbols
of second and first kind $\{{}^\alpha_{\beta\gamma}\}$
and $[{}_{\alpha,\beta\gamma}]$ having identifiers
\comm{CHR} and \comm{CHRF} respectively
\begin{slisting}
<- Show CHR;

CHR^x_y_z is Scalar Macro Object
  Symmetries: s(2,3)

<- ? CHRF;

CHRF_u_v_w is Scalar Macro Object
  Symmetries: s(2,3)
\end{slisting}


\subsection{New Object Declaration}

\grg\ has very large number of built-in quantities
but you are not obliged to use them in your calculations
instead you can define new quantities. The command\cmdind{New Object}
\command{New Object \parm{ID}\,\opt{\parm{ilst}}\,\opt{is \parm{ctype}}\,\opt{with \opt{Symmetries}\,\parm{slst}};}
declares a new object. The words \comm{New} or \comm{Object} are
optional (but not both) so the above command are equivalent to
\command{Object \parm{ID}\,\opt{\parm{ilst}}\,\opt{is \parm{ctype}}\,\opt{with \opt{Symmetries}\,\parm{slst}};\\\tt
New \parm{ID}\,\opt{\parm{ilst}}\,\opt{is \parm{ctype}}\,\opt{with \opt{Symmetries}\,\parm{slst}}; }
Here \parm{ID} is an identifier of a new object. The identifier can
contain letters \comm{a}--\comm{z}, \comm{A}--\comm{Z} but neither
digits nor any other symbols. The identifier must be unique and cannot
coincide with the identifier of any other built-in or user-defined object.

The \parm{ilist} is the list of indices having the form \label{indices}
\command{\rpt{\parm{ipos}\ \parm{itype}}}
where \parm{ipos} defines the index position and \parm{itype}
specifies its type. The coordinate holonomic and frame indices
are denoted by single lower-case letters with \parm{ipos}
\command{{\tt '}\rm\ \ upper frame index
\\{\tt .}\rm\ \ lower frame index
\\{\tt \^}\rm\ \ upper holonomic index
\\{\tt \_}\rm\ \ lower holonomic index}
The frame and holonomic indices in \grg\ take values from 0 to
$d-1$ where $d$ is the current space dimensionality.\index{Dimension}

Spinorial indices are denoted by upper case letters
with trailing \comm{\cc} for conjugated spinorial indices:
\comm{A}, \comm{B\cc} etc. Summed spinorial index of rank $n$ is
denoted by $n$ upper-case letters. For example \comm{ABC} denotes
summed spinorial index of the rank 3 (runs from 0 to 3)
and \comm{AB\cc} denotes conjugated summed index of the rank 2
(values 0, 1, 2). The upper position for spinorial indices
are denoted either by \comm{'} or \comm{\^} and lower one by
\comm{.} or \comm{\_}.

Finally the enumerating indices are denoted by a single
lower-case letter followed either by digits or by \comm{dim}.
For example the index declared as \comm{i2} runs from 0
to 2 while specification \comm{a13} denotes index whose
values runs from 0 to 13.
The specification \comm{idim} denotes enumerating index
which takes the values from 0 to $d-1$.
Upper of lower position for enumerating indices are identical,
thus in this case symbols \comm{' . \^ \_} are equivalent.

The \parm{ctype} defines the type of new object component:
\command{Scalar \opt{Density \parm{dens}}\\\tt
\parm{p}-form \opt{Density \parm{dens}}\\\tt
Vector \opt{Density \parm{dens}}}
This part of the declaration can be omitted and then the object
is assumed to be  scalar-valued. The \parm{dens} defines pseudo-scalar
and density properties of the object with respect to
coordinate and frame transformations:
\command{\opt{sgnL}\opt{*sgnD}\opt{*L\^\parm{n}}\opt{*D\^\parm{m}}}
where \comm{D} and \comm{L} is the coordinate transformation
determinant ${\rm det}(\partial x^{\alpha'}/\partial x^\beta)$ and
frame transformation determinant ${\rm det}(L^a{}_b)$ respectively.
If \comm{sgnL} or \comm{sgnD} is specified then under appropriate
transformation the object must be multiplied on the
sign of the corresponding determinant (pseudo tensor).
The specification \comm{L\^\parm{n}} or \comm{D\^\parm{m}} means
that the quantity must be multiplied on the appropriate
degree of the corresponding determinant (tensor density).
The parameters \parm{p}, \parm{n} and \parm{m} may be given
by expressions (must be enclosed in brackets) but value
of these expressions must be always integer and positive
in the case of \parm{p}.

The symmetry specification \parm{slst} is a list
\command{\rpt{\parm{slst1}}}
where each element \parm{slst1} describes symmetries
for one group of indices and has the form
\command{\parm{sym}(\rpt{\parm{slst2}})}
The \parm{sym} determines type of the symmetry
\command{%
\tt s \ \rm symmetry \\
\tt a \ \rm antisymmetry \\
\tt c \ \rm cyclic symmetry \\
\tt h \ \rm Hermitian symmetry}
and \parm{slst2} is either index number \parm{i} or list of
index numbers \comm{(\rpt{\parm{i}})} or another symmetry
specification of the form  \parm{slst1}. Notice that $n$th
object index can be present only in one of the \parm{slst1}.

Let us consider an object having four indices.
Then the following symmetry specifications are possible

\begin{tabular}{ll}
\comm{s(1,2,3,4)} & total symmetry     \\[1mm]
\comm{a(1,2),s(3,4)} &  antisymmetry in first pair of indices and \\
                     &  symmetry in second pair  \\[1mm]
\comm{s((1,2),(3,4))} &  symmetry in pair permutation  \\[1mm]
\comm{s(a(1,2),a(3,4))} & antisymmetry in first and second pair of  indices \\
                        & and symmetry in pair permutation
\end{tabular}\newline
The last example is the well known symmetry of Riemann curvature tensor.
The specification \comm{a(1,2),s(2,3)} is erroneous since
second index present in both parts of the specification
which is not allowed.

Declaration for new equations is completely similar\cmdind{New Equation}
\command{\opt{New} Equation \parm{ID}\,\opt{\parm{ilst}}\,\opt{is \parm{ctype}}\,\opt{with \opt{Symmetries}\,\parm{slst}};}

\grg\ knows four types of connections:\cmdind{New Connection} \label{conn2}
\begin{list}{$\bullet$}{\labelwidth=4mm\leftmargin=\parindent}
\item Frame Connection 1-form $\omega^a{}_b$ having first upper and second lower frame indices
\item Holonomic Connection 1-form $\Gamma^\alpha{}_\beta$ having first upper and second lower coordinate indices
\item Spinor Connection 1-form $\omega_{AB}$ with lower spinor index of rank 2
\item Conjugated Spinor Connection $\omega_{\dot{A}\dot{B}}$ 1-form with lower conjugated spinor index of rank 2
\end{list}
Each of these connections are used to construct covariant derivatives
with respect to corresponding indices. In addition they are properly
transformed under the coordinate change and frame rotation.
There are complete set of built-in connections but you can declare
a new one by the command
\command{%
\opt{New} Connection \parm{ID}'a.b \opt{is 1-form};\\\tt
\opt{New} Connection \parm{ID}\^m\_n \opt{is 1-form};\\\tt
\opt{New} Connection \parm{ID}.AB\ \opt{is 1-form};\\\tt
\opt{New} Connection \parm{ID}.AB\cc\ \opt{is 1-form};}
Notice that any new connection must belong to one of the listed
above types and have indicated type and position of indices. This
representation of connection is chosen in \grg\ for the sake of
definiteness.

There is one special case when new object can be declared
without explicit \comm{New Object} declaration. Let us
consider the following example:
\begin{slisting}
<- Coordinates t, x, y, z;
<- www=d x;
<- Show www;

www is 1-form
  Value: known
\end{slisting}
If we assign the value to some identifier \parm{id}
(\comm{www} in our example)
\seethis{See page \pageref{assig} about assignment command.}
and this identifier is not reserved yet by any other object then
\grg\ automatically declares a new object without indices
labeled by the identifier \parm{id} and having the type
of the expression in the right-hand side of the assignment
(1-form in our example). Notice that the \parm{id} must not include
digits since digits represent indices and any new object
with indices must be declared explicitly.

The command
\command{Forget \parm{ID};}
completely removes the user-defined object with the
identifier \parm{ID}.

Finally let us consider some examples:
\begin{slisting}
<- Coordinates t, x, y, z;
<- New RNEW'a.b_c_d is scalar density sgnD with a(3,4);
<- Show RNEW;

RNEW'a.b_x_y is Scalar Density sgnD
  Value: unknown
  Symmetries: a(3,4)

<- Null Metric;
<- Connection omnew.AA;
<- Show omnew;

omnew.AB is 1-form Spinor Connection
  Value: unknown
\end{slisting}
Here the first declaration defines a new scalar valued pseudo tensor
$\mbox{\comm{RNEW}}^a{}_{b\gamma\delta}$ which is antisymmetric
in the last pair of indices. Second declaration introduce new spinor
connection \comm{omnew}. Notice that new connection is automatically
declared 1-form and the type of connection is derived by the
type of new object indices (lower spinorial index of rank 2 in our
example).


\section{Assignment Command}
\index{Assignment (command)}\label{assig}

The assignment command sets the value to the particular
components of the object. In general it has the form
\command{\opt{\parm{Name}} \rpt{\parm{comp} = \parm{expr}};}
or for equations
\command{\opt{\parm{Name}} \rpt{\parm{comp} = \parm{lhs}=\parm{rhs}};}
Here \parm{Name} is the optional object name. If the object
has no indices then \parm{comp} is the object identifier.
If the object has indices then \parm{comm} consist of identifier
with additional digits denoting indices.
For example the following command assigns standard spherical flat
value to the frame $\theta^a$
\begin{listing}
   Frame
     T0 = d t,
     T1 = d r,
     T2 = r*d theta,
     T3 = r*SIN(theta)*d phi;
\end{listing}
and the command
\begin{listing}
   RIM0123 = 100;
\end{listing}
assigns the value to the $R^0{}_{123}$ component of the Riemann tensor.
Notice that in this notation each digit is considered as one index,
thus it does not work if the value of some index is greater than 9
(e.g. if dimensionality is 10 or greater). In this case another
notation can be used in which indices are added to the object
identifier as a list of digits enclosed in brackets
\command{\opt{\parm{Name}} \parm{ID}(\rpt{\parm{n}})~= \parm{expr};}
In particular the command
\begin{listing}
   RIM(0,1,2,3) = 100;
\end{listing}
is equivalent to the example above.

The assignment set value only to the certain components of an object
leaving other components  unchanged. But if before assignment
the object was in indefinite state (no value is known) then assignment
turns it to the definite state and all other components of the object
are assumed to be zero.

The digits standing for object indices in the left-hand side
of an assignment can be replaced by identifiers
\index{Assignment (command)!tensorial}
\command{\opt{\parm{Name}} \parm{ID}(\rpt{\parm{id}})~= \parm{expr};}
Such assignment is called \emph{tensorial} one.
For example the following tensorial assignment set the value to the
curvature 2-form $\Omega^a{}_b$
\begin{listing}
   OMEGA(a,b) = d omega(a,b) + omega(a,m){\w}omega(m,b);
\end{listing}
This command is equivalent to $d\times d$ of assignments where \comm{a}
and \comm{b} take values from 0 to $d-1$ ($d$ is the space dimensionality).\index{Dimension}
Notice that identifiers in the left-hand side of tensorial assignment
must not coincide with any predefined or declared by the user
constant or coordinate. It is possible to mix digits and identifiers:
\begin{listing}
   FT(0,a) = 0;
\end{listing}
Here \comm{FT} is identifier of the built-in object
{\tt EM Tensor} which is the electromagnetic strength tensor $F_{ab}$
and this command sets the electric part of the tensor to zero.

The assignment command takes into account symmetries of the
objects. For example {\tt EM Tensor} is antisymmetric
and in order to assign value say to the components $F_{01}=-F_{10}$
it suffices to do this just for one of them
\begin{slisting}
<- Coordinates t, x, y, z;
<- EM Tensor FT01=111, FT(3,2)=222;
<- Write FT;
EM tensor:

FT     = 111
   t x

FT     = -222
   y z
\end{slisting}
We can see that \grg\ automatically transforms indices to the
\emph{canonical} order. This rule works in the case or
tensorial assignment as well
\begin{slisting}
<- Coordinates t, x, y, z;
<- Function ff;
<- EM Tensor FT(a,b)=ff(a,b);
<- Write FT;
EM tensor:

FT     = ff(0,1)
   t x

FT     = ff(0,2)
   t y

FT     = ff(0,3)
   t z

FT     = ff(1,2)
   x y

FT     = ff(1,3)
   x z

FT     = ff(2,3)
   y z

<- FT(2,1);

 - ff(1,2)
\end{slisting}
In this case both parameters \comm{a} and \comm{b} runs from 0 to 3
but \grg\ assigns the value only to the components
having indices in the canonical order \comm{a}$<$\comm{b}.
\grg\ follows this rule also if in the left-hand
side of tensorial assignment digits are mixed with
parameters which may sometimes produce unexpected result:
\begin{slisting}
<- Coordinates t, x, y, z;
<- Function ee;
<- FT(0,a)=ee(a);
<- Write FT;
EM tensor:

FT     = ee(1)
   t x

FT     = ee(2)
   t y

FT     = ee(3)
   t z

<- Erase FT;
<- FT(3,a)=ee(a);
<- Write FT;
EM tensor:

0
\end{slisting}
Observe the difference between these two assignments (the command
\comm{Erase FT;} destroys the previously assigned value).
In fact second assignment assigns no values since
\comm{3} and \comm{a} are not in the canonical order
\comm{3}$\geq$\comm{a} for \comm{a} running from 0 to 3.
Notice the difference from the case when all indices in
the left-hand side are given by the explicit numerical values.
In this case \grg\ automatically transforms the indices to their
canonical order and \comm{FT(3,2)=222;} is equivalent
to \comm{FT(2,3)=-222;}.


Finally there is one more form of the tensorial assignment
which can be applied to the summed spinorial indices.
\index{Assignment (command)!summed spinor indices}
Let us consider the spinorial analogue of electromagnetic strength
tensor $\Phi_{AB}$. This spinor is irreducible (i.e. symmetric in $\scriptstyle AB$).
The corresponding \grg\ built-in object {\tt Undotted EM Spinor}
(identifier \comm{FIU}) has one summed spinorial index of rank 2.
Let us consider two different assignment commands
\begin{slisting}
<- Coordinates u, v, z, z~;

z & z~ - conjugated pair.

<- Null Metric;
<- Function ee;
<- FIU(a)=ee(a);
<- Write FIU;
Undotted EM spinor:



FIU  = ee(0)
   0

FIU  = ee(1)
   1

FIU  = ee(2)
   2

<- Erase FIU;
<- FIU(a+b)=ee(a,b);
<- Write FIU;
Undotted EM spinor:

FIU  = ee(0,0)
   0

FIU  = ee(0,1)
   1

FIU  = ee(1,1)
   2
\end{slisting}
In the first case \comm{a} is treated as a summed index
and runs from 0 to 2 but in the second case \comm{a} and \comm{b}
are considered as usual single SL(2,C) spinorial indices
each having values 0 and 1.

The notation for the object components in the left-hand
side of assignment do not distinguishes upper and lower
indices. Actually the indices are always assumed to be in
the default position.
You can always check the default index types and positions
using the command \comm{Show \parm{object};}.\cmdind{Show \parm{object}}
For example the {\tt Riemann Tensor} has first upper and
three lower frame indices and the command \comm{RIM0123=100;}
and \comm{RIM(0,1,2,3)=100;} both assign value to the
$R^0{}_{123}$ component of the tensor where indices are
represented with respect to the current frame.


\section{Geometry}

The number of built-in objects in \grg\ is rather large.
They all described in chapter 3 and appendices B and C.
In this section we consider only the most important ones.

\subsection{Metric, Frame and Line-Element}
\index{Metric}\index{Frame}
\label{metric}

The line-element in \grg\ is defined by the
following equation
\begin{equation}
ds^2 = g_{ab}\,\theta^a\!\otimes\theta^b
\end{equation}
where $\theta^a=h^a_\mu dx^\mu$ is the frame 1-form and $g_{ab}$ is the
frame metric. The corresponding built-in objects are
\comm{Frame} (identifier \comm{T}) and \comm{Metric}
(identifier \comm{G}). There are also the ``inverse''
counterparts $\partial_a=h_a^\mu\partial_\mu$ ({\tt Vector Frame},
identifier \comm{D}) and $g^{ab}$ ({\tt Inverse Metric}, identifier
\comm{GI}). To determine the metric properties of the space
you can assign some values to both the metric and the frame.
There are two well known special cases. First is the usual
coordinate formalism in which frame is holonomic $\theta^a=dx^\alpha$.
In this case there is no difference between frame and coordinate
indices. Another representation is known as the tetrad (in dimension 4)
formalism. In this case frame metric equals to some constant
matrix $g_{ab}=\eta_{ab}$ and significant information about
line-element ``is encoded'' in the frame.

In general both metric and frame can be nontrivial but not
necessarily. If no any value is given by user to the frame
when \grg\ automatically assumes that frame is \emph{holonomic}
\index{Frame!default value}
\begin{equation}
\theta^a=dx^\alpha
\end{equation}
Thus if we assign the value to metric only we automatically
get standard coordinate formalism. On the contrary if
no value is assigned to the metric then \grg\ automatically
assumes\index{Signature} \label{defaultmetric}
\index{Metric!default value}
\begin{equation}
g_{ab} = {\rm diag}(+1,-1,\dots)
\end{equation}
where $+1$ and $-1$ on the diagonal of the matrix
correspond to the current signature specification.

Notice that current signature is printed among other
information by the command\cmdind{Show Status}\cmdind{Status}
\command{\opt{Show} Status;}
and current line-element is printed by the command
\cmdind{ds2}
\command{ds2;}
or equivalently\cmdind{Line-Element}
\command{Line-Element;}

Finally if neither frame nor metric are specified by user
then both these quantities acquire default value and we
automatically obtain flat space of the default signature:
\begin{slisting}
<- Dimension 4 with Signature(-,+,+,+);
<- Coordinates t, x, y, z;
<- ds2;
Assuming Default Metric.
Metric calculated By default. 0.05 sec
Assuming Default Holonomic Frame.
Frame calculated By default. 0.05 sec

   2          2       2       2       2
 ds  =  -  d t  +  d x  +  d y  +  d z

\end{slisting}


\subsection{Spinors}
\label{spinors}

Spinorial representations exist in spaces of various dimensions
and signatures but in \grg\ spinors are restricted
to the 4-dimensional spaces of Lorentzian signature ${\scriptstyle(-,+,+,+)}$
or ${\scriptstyle(+,-,-,-)}$ only. Another restriction is that in the
spinorial formalism the metric must be the \index{Metric!Standard Null}
\emph{standard null metric}:
\index{Standard null metric}\index{Spinors}\index{Spinors!Standard null metric}
\begin{equation}
g_{ab}=g^{ab}=\pm\left(\begin{array}{rrrr}
0  & -1 & 0 & 0 \\
-1 &  0 & 0 & 0 \\
0  &  0 & 0 & 1 \\
0  &  0 & 1 & 0
\end{array}\right)
\end{equation}
where upper sign correspond to the signature ${\scriptstyle(-,+,+,+)}$ and
lower sign to the signature ${\scriptstyle(+,-,-,-)}$.
There is special command\cmdind{Null Metric}
\command{Null Metric;}
which assigns this standard value to the metric.

Thus spinorial frame (tetrad) in \grg\ must be null
\begin{equation}
ds^2 = \pm(-\theta^0\!\otimes\theta^1
-\theta^1\!\otimes\theta^0
+\theta^2\!\otimes\theta^3
+\theta^3\!\otimes\theta^2)
\end{equation}
and conjugation rules for this tetrad must be
\begin{equation}
\overline{\theta^0}=\theta^0,\quad
\overline{\theta^1}=\theta^1,\quad
\overline{\theta^2}=\theta^3,\quad
\overline{\theta^3}=\theta^2
\end{equation}

For the sake of efficiency the sigma-matrices $\sigma^a\!{}_{A\dot{B}}$
for such a tetrad are chosen in the simplest form. The only
nonzero components of the matrices are\index{Sigma matrices}
\begin{eqnarray}
&&\sigma_0{}^{1\dot{1}}=
\sigma_1{}^{0\dot{0}}=
\sigma_2{}^{1\dot{0}}=
\sigma_3{}^{0\dot{1}}=1 \\[1mm] &&
\sigma^0{}_{1\dot{1}}=
\sigma^1{}_{0\dot{0}}=
\sigma^2{}_{1\dot{0}}=
\sigma^3{}_{0\dot{1}}=\mp1
\end{eqnarray}


\subsection{Connection, Torsion and Nonmetricity}
\label{conn}

As was explained above \grg\ recognizes four types of connections:
holonomic $\Gamma^\alpha{}_\beta$, frame $\omega^a{}_b$,
spinorial $\omega_{AB}$ and conjugated spinorial
$\omega_{\dot{A}\dot{B}}$. Accordingly there are four
built-in objects: {\tt Holonomic Connection} (id. \comm{GAMMA}),
{\tt Frame Connection} (id. \comm{omega}), {\tt Undotted Connection}
(id. \comm{omegau}), {\tt Dotted Connection} (id. \comm{omegad}).
Connections are used in \grg\ in covariant derivatives. In addition
they are properly transformed under frame and coordinate
transformations.

By default the connection in \grg\ are assumed to be Riemannian.
In particular in this case holonomic connection is nothing but
Christoffel symbols $\Gamma^\alpha{}_\beta=
\{{}^\alpha_{\beta\pi}\}dx^\pi$.
If it is necessary to work with torsion and/or nonmetricity
\swind{TORSION}\swind{NONMETR}
then the switches \comm{TORSION} and/or \comm{NONMETR}
must be turned on. \seethis{See \pref{conn2} about the built-in connections.}
In this case the Riemannian analogues
or the aforementioned four connections are available as well.


\section{Expressions}

Expressions in \grg\ can be algebraic (scalar), vector or
p-form valued. \grg\ knows all the usual mathematical operations
on algebraic expressions, exterior forms and vectors.

\subsection{Operations and Operators}

The operations known to \grg\ are presented in the form of the table.
Operations are subdivided into six groups separated by horizontal
lines. Operations in each group have equal level of precedence and
the precedence level decreases from the top to the bottom of the table.
As in usual mathematical notation we can use brackets \verb"( )"
to change operation precedence.

Other constructions which can be used in expression are
described below.

\begin{table}
\begin{center}
\begin{tabular}{|c|c|c|}
\hline
{\bf Operation} & {\bf Description} & {\bf Grouping} \\
\hline
{\tt [$v_1$,$v_2$]} & Vector bracket          &                  \\
\hline
{\tt @} $x$         & Holonomic vector $\partial_x$ &            \\
\cline{1-2}
{\tt d} $a$         & Exterior differential   &                  \\
{\tt d} $\omega$    &                         &
          {\tt d} \cc$a$ $\Leftrightarrow$ {\tt (d(}\cc$a${\tt))} \\
\cline{1-2}
{\tt \dd} $a$       & Dualization             &                   \\
{\tt \dd} $\omega$  &                         &                   \\
\cline{1-2}
{\tt \cc} $e$       & Complex conjugation     &                   \\
\hline
$a_1${\tt **}$a_2$  & Exponention             &                   \\
$a_1${\tt\^} $a_2$  &                         &                   \\
\hline
$e$\ {\tt /}\ $a$   & Division                &
          $e${\tt /}$a_1${\tt /}$a_2$ $\Leftrightarrow$
{\tt (}$e${\tt /}$a_1${\tt )/}$a_2$  \\
\hline
$a$\ {\tt *}\ $e$   & Multiplication          &                                   \\
\cline{1-2}
$v$\ {\tt |}\ $a$   & Vector acting on scalar &
$v$\ii$\omega_1$\w$\omega_2${\tt *}$a$ \\
\cline{1-2}
$v$\ \ip\ $\omega$  & Interior product        & $\Updownarrow$  \\
\cline{1-2}
$v_1$\ {\tt.}\ $v_2$& Scalar product          &
$v$\ii{\tt (}$\omega_1$\w{\tt(}$\omega_2${\tt *}$a${\tt ))} \\
$v$\ {\tt.}\ $o$    &                         &                    \\
$o_1$\ {\tt.}\ $o_2$&                         &                    \\
\cline{1-2}
$\omega_1$\ \w\ $\omega_2$ & Exterior product &                    \\
\hline
{\tt +}\ $e$        & Prefix plus             &                    \\
\cline{1-2}
{\tt -}\ $e$        & Prefix minus            &                    \\
\cline{1-2}
$e_1$\ {\tt +}\ $e_2$ & Addition              &                    \\
\cline{1-2}
$e_1$\ {\tt -}\ $e_2$ & Subtraction           &                    \\
\hline
\end{tabular}
\end{center}
\label{operators}
\caption{Operation and operators. Here:
$e$ is any expression,
$a$ is any scalar valued (algebraic) expressions,
$v$ is any vector valued expression,
$x$ is a coordinate,
$o$ is any 1-form valued expression,
$\omega$ is any form valued expression.}
\end{table}



\subsection{Variables and Functions}

Operator listed in the table 2.2 act on
the following types of the operands:
\begin{itemize}
\item[(i)]   integer numbers (e.g. {\tt 0}, {\tt 123}),
\item[(ii)]  symbols or identifiers (e.g. {\tt I}, {\tt phi}, {\tt RIM0103}),
\item[(iii)] functional expressions (e.g. {\tt SIN(x)}, {\tt G(0,1)} etc).
\end{itemize}

Valid identifier must belong to one of the following types:
\begin{itemize}
\item Coordinate.
\item User-defined or built-in constant.
\item Function declared with the implicit dependence list.
\item Component of an object.
\end{itemize}

Any valid functional expression must belong to one of the following types:
\itemsep=0.5mm
\begin{itemize}
\item User-defined function.
\item Function defined in \reduce\ (operator).
\item Component of built-in or user-defined object in functional notation.
\item Some special functional expressions listed below.
\end{itemize}

\subsection{Derivatives}

The derivatives in \grg\ and \reduce\ are written as
\command{DF(\parm{a},\rpt{\parm{x}\opt{,\parm{n}}})}
where \parm{a} is the differentiated expression, \parm{x} is
the differentiation variable and integer number \parm{n} is
the repetition of the differentiation. For example
\[
\mbox{\tt DF(f(x,y),x,2,y)}=\frac{\partial^3f(x,y)}{\partial^2x\partial y}
\]

There are also another type of derivatives
\command{DFP(\parm{a},\rpt{\parm{x}\opt{,\parm{n}}})}
\seethis{See section \ref{genfun} about the generic functions.}
They are valid only after {\tt Generic Function}
declaration if the package \file{dfpart}
is installed on your system.

\subsection{Complex Conjugation}

Symbol \comm{\cc\cc} in the sum of terms is an abbreviation:
\command{%
\tt $e$ + \cc\cc\ $=$\ $e$ + \cc$e$ \\
\tt $e$ - \cc\cc\ $=$\ $e$ - \cc$e$ }

Functions \comm{Re} and \comm{Im} gives real and imaginary
parts of an expression:
\command{%
\tt Re($e$)\ $=$\ ($e$+\cc$e$)/2 \\
\tt Im($e$)\ $=$\ I*(-$e$+\cc$e$)/2}
\subsection{Sums and Products}
The following expressions represent sum and product
\command{Sum(\rpt{\parm{iter}},\parm{e})\\\tt
Prod(\rpt{\parm{iter}},\parm{e})}
where \parm{e} is the summed expression and \parm{iter}
defines summation variables.
The range of summation can be \label{iter}
specified by two methods. First ``long'' notation is
\command{\parm{id} = \parm{low}..\parm{up}}
and the identifier \parm{id} runs from \parm{low} up to
\parm{up}. Both \parm{low} and \parm{up} can be given
by arbitrary expressions but value of these expressions
must be integer. The \parm{low} can be omitted
\command{\parm{id} = \parm{up}}
and in this case \parm{id} runs from 0 to \parm{up}.
The identifier \parm{id} should not coincide with any
built-in or user-defined variable.


In ``short'' notation \parm{iter} is just identifier \label{siter}
\parm{id} and its range is determined using
the following rules
\begin{list}{$\bullet$}{\labelwidth=4mm\leftmargin=\parindent}
\item Mixed letter-digit \parm{id} runs from 0 to $d-1$
      where $d$ is the space dimensionality.
\begin{verbatim}
     Aid  j2s
\end{verbatim}
\item The \parm{id} consisting of lower-case letters runs from
      $0$ to $d-1$
\begin{verbatim}
     j  a  abc  kkk
\end{verbatim}
\item The \parm{id} consisting of upper-case letters runs from
      $0$ to the number of letters in \parm{id}, e.g. the following
      identifiers run from 0 to 1 and from 0 to 3 respectively
\begin{verbatim}
     B  ABC
\end{verbatim}
\item Letters with one trailing digit run from 0 to the value
      of this digit. Both \parm{id} below runs from 0 to 3:
\begin{verbatim}
     j3  A3
\end{verbatim}
\item Letters with two digits run from the value of the
      first digit to the value of the second digit. The \parm{id} below
      run from 2 to 3:
\begin{verbatim}
     j23  A23
\end{verbatim}
\item Letters with 3 or more digits are incorrect
\begin{verbatim}
     j123
\end{verbatim}
\end{list}

Two or more summation parameters are separated either
by commas or by  one of the relational operators
\begin{listing}
    <   >   <=   =>
\end{listing}
This means that only the terms satisfying these relations
will be included in the sum. For example
\[
\mbox{\tt Sum(i24<=ABC,k=1..d-1,f(i24,ABC,k))} =
\sum_{i=2}^{4} \sum_{\scriptstyle a=0\atop\scriptstyle i\leq a}^{3} \sum^{d-1}_{k=1} f(i,a,k)
\]

\enlargethispage{5mm}

\grg's \comm{Sum} and \comm{Prod}
\seethis{Use \comm{SUM}, \comm{PROD} or \comm{sum}, \comm{prod}
depending on \reduce\ internal case as explained on page
\pageref{case}.}
should not be confused with \reduce's \comm{SUM} and \comm{PROD}
which are also available in \grg. \grg's \comm{Sum} apply
to any scalar, vector or form-valued expressions and always
expanded by \grg\ into the appropriate explicit sum of terms. On the
contrary \comm{SUM} defined in \reduce\ can be applied to the
algebraic expressions only. \grg\ leaves such expression unchanged
and passes
it to the \reduce\ algebraic evaluator. Unlike \comm{Sum} the
summation limits in \comm{SUM} can be given by algebraic
expressions. If value of these expressions is integer then
result of the \comm{SUM} will be the same as for \comm{Sum}
but if summation limits are symbolic sometimes \reduce\ is capable
to find a closed expression for such a sum but not always.
See the following example
\begin{slisting}
<- Coordinates t, x, y, z;
<- Function f;
<- Constants n, m;
<- Sum(k=1..3,f(k));

f(3) + f(2) + f(1)

<- SUM(f(n),n,1,3);

f(3) + f(2) + f(1)

<- SUM(n,n,1,m);

 m*(m + 1)
-----------
     2

<- SUM(f(n),n,1,m);

SUM(f(n),n,1,m)
\end{slisting}

\newpage

\subsection{Einstein Summation Rule}

According to the Einstein summation rule if \grg\ encounters
some unknown repeated identifier \parm{id} then summation over this
\parm{id} is performed. The range of the summation variable
is determined according to the ``short'' notation explained in
the previous section.


\subsection{Object Components and Index Manipulation}

The components of built-in or user-defined object can be
denoted in expressions by two methods which are
similar to the notation used in the left-hand side of the
assignment command. The first method uses the object identifier
with additional digits denoting the indices {\tt T0}, {\tt RIM0213}.
The second method uses the functional
notation {\tt T(0)}, {\tt RIM(0,2,1,3)}, {\tt OMEGA(j,k)}.

In functional notation the default index type and position
\index{Index manipulations}
can be changed using the markers: {\tt '} upper frame,
{\tt .} lower frame, {\tt \^} upper holonomic, {\tt \_} lower
holonomic. For example expression {\tt RIM(a,b,m,n)}
gives components of Riemann tensor with the default indices
$R^a{}_{bmn}$ (first upper frame and three lower frame indices)
while expression {\tt RIM('a,'b,\_m,\_n)} gives
$R^{ab}{}_{\mu\nu}$ with two upper frame and two lower coordinate
indices. For enumerating indices position markers are ignored
and only {\tt '} and {\tt .} works for spinorial indices.

In the spinorial formalism
\seethis{See \pref{spinors} about spinorial formalism.}
each frame index can be replaced by a pair if spinorial indices
according to the formulas:
\[
A^a\sigma_a{}^{B\dot{D}}=A^{B\dot{D}},\qquad
B_a\sigma^a\!{}_{B\dot{D}}=B_{B\dot{D}}
\]
Accordingly any frame index can be replaced by a pair of
spinorial indices.
\label{sumspin}
Similarly one summed spinorial index or rank $n$ can be
replaced by $n$ single spinor indices.
There is only one restriction. If an object has several
frame and/or summed spinorial indices then \emph{all}
must be represented in such expanded form.
In the following example the null frame $\theta^a$
is printed in the usual and spinorial $\theta^{B\dot C}$
representations. The relationship
$\theta^a\sigma_a{}^{B\dot C}-\theta^{B\dot C}=0$ is
verifies as well
\begin{slisting}
<- Coordinates u, v, z, z~;

z & z~ - conjugated pair.

<- Null Metric;
<- Frame T(a)=d x(a);
<- ds2;
\newpage
   2
 ds  =  (-2) d u d v + 2 d z d z~

<- T(a);

a=0 :  d u

a=1 :  d v

a=2 :  d z

a=3 :  d z~

<- T(B,C);

B=0 C=0 :  d v

B=0 C=1 :  d z~

B=1 C=0 :  d z

B=1 C=1 :  d u

<- T(a)*sigmai(a,B,C)-T(B,C);

0
\end{slisting}


\subsection{Parts of Equations and Solutions}
\index{Equations!in expressions}

The functional expressions
\command{LHS(\parm{eqcomp})\\\tt
RHS(\parm{eqcomp})}
give access to the left-hand and right-hand side of an
equation respectively. Here \parm{eqcomp} is the
component of the equation as explained in the
previous section.

The \comm{LHS}, \comm{RHS} also provide access to the \parm{n}'th
\seethis{See page \pageref{solutions} about solutions.}
solution if \parm{eqcomp} is \comm{Sol(\parm{n})}.


\subsection{Lie Derivatives}
\index{Lie derivatives}

The Lie derivative is given by the expression
\command{Lie(\parm{v},\parm{objcomp})}
where \parm{objcomp} is the component of an object in
functional notation. For example the following
expression is the Lie derivative of the metric $\pounds_vg_{ab}$
\begin{listing}
   Lie(vec,G(a,b));
\end{listing}
The index manipulations in the Lie derivatives are permitted.
In particular the expression
\begin{listing}
   Lie(vec,G(^m,b));
\end{listing}
is the Lie derivative of the frame $\pounds_vg^\mu{}_{b}
\equiv \pounds_vh^\mu_a$
and must vanish.




\subsection{Covariant Derivatives and Differentials}
\index{Covariant derivatives}\index{Covariant differentials}
\label{cder}

The covariant differential
\command{Dc(\parm{objcomp}\opt{{\upshape\tt ,}\rpt{\parm{conn}}})}
and covariant derivative
\command{Dfc(\parm{v},\parm{objcomp}\opt{{\upshape\tt ,}\rpt{\parm{conn}}})}
Here \parm{objcomp} is an object component in functional notation
and \parm{v} is a vector-valued expression.
The optional parameters \parm{conn} are the identifiers of
connections.
\seethis{See page \pageref{conn} about the built-in connections.}
If \parm{conn} is omitted then \grg\ uses default
connection for each type of indices: frame, coordinate,
spinor and conjugated spinor. If \parm{conn} is indicated
then \grg\ uses this connection instead of default one
for appropriate type of indices. For example expression
\begin{listing}
  Dc(OMEGA(a,b))
\end{listing}
is the covariant differential of the curvature 2-form $D\Omega^a{}_b$.
This expression should vanish in Riemann space and should be
proportional to the torsion in Riemann-Cartan space.
Here \grg\ will use default object {\tt Frame connection}
(id. \comm{omega}). The expression
\begin{listing}
  Dc(OMEGA(a,b),romega)
\end{listing}
is similar but it uses another built-in connection
{\tt Riemann frame connection } (id. \comm{romega}) which
are different if torsion or nonmetricity are nonzero.
The index manipulations are allowed in the covariant derivatives.
For example  the expression
\begin{listing}
  Dfc(v,RIC(\^m,\_n))
\end{listing}
gives the covariant derivative of the curvature of the
Ricci tensor with first coordinate upper and second coordinate lower
indices $\nabla_vR^\mu{}_\nu$.

\subsection{Symmetrization}

The functional expressions works iff the switch \swind{EXPANDSYM}
\comm{EXPANDSYM} is on
\command{%
Asy(\rpt{\parm{i}},\parm{e})\\\tt
Sy(\rpt{\parm{i}},\parm{e})\\\tt
Cy(\rpt{\parm{i}},\parm{e})}
They produce antisymmetrization, symmetrization and cyclic symmetrization
of the expression \parm{e} with respect to \parm{i} without
corresponding $1/n$ or $1/n!$.


\subsection{Substitutions}
\index{Substitutions}\label{subs}

The expression
\command{SUB(\rpt{\parm{sub}},\parm{e})}
is similar to the analogous expression in \reduce\ with two
generalizations: (i) it applies not only to algebraic
but to form and vector valued expression \parm{e} as well,
\seethis{See page \pageref{solutions} about solutions.}
(ii) as in {\tt Let} command \parm{sub} can be either
the relation {\tt \parm{l}\,=\,\parm{r}} or solution
{\tt Sub(\parm{n})}.


\subsection{Conditional Expressions}
\index{Conditional expressions}\index{Boolean expressions}

The conditional expression
\command{If(\parm{cond},\parm{e1},\parm{e2})}
chooses \parm{e1} or \parm{e2} depending on the value of the
boolean expression \parm{cond}.

Boolean expression appears in (i) the conditional expression
\label{bool}
{\tt If}, (ii) in {\tt For all Such That} substitutions.
Any nonzero expression is considered as {\bf true} and
vanishing expression as {\bf false}. Boolean expressions
may contain the following usual relations and logical
operations: {\tt < > <= >= = |= not and or}. They also may
contain the following predicates  \vspace*{2mm}

\begin{tabular}{|l|l|}
\hline
\tt OBJECT(\parm{obj}) & Is \parm{obj}  an object identifier or not   \\
\hline
\tt ON(\parm{switch})      & Test position of the \parm{switch}      \\
\tt OFF(\parm{switch})    &                                            \\
\hline
\tt ZERO(\parm{object})    & Is the value of the \parm{object} zero or not \\
\hline
\tt HASVALUE(\parm{object}) & Whether the \parm{object} has any value or not \\
\hline
\tt NULLM(\parm{object}) & Is the \parm{object} the standard null metric \\
\hline
\end{tabular} \vspace*{2mm} \newline
Here \parm{object} is an object identifier.

The expression \comm{ERROR("\parm{message}")} causes an error
with the \comm{"\parm{message}"}. It can be used
to test any required conditions during the batch file execution.


\subsection{Functions in Expressions}

Any function which appear in expression must be
either declared by the \comm{Function} declaration or
be defined in \reduce\ (in \reduce\ functions are called
operators). In general arguments of functions in \grg\ must be
algebraic expression with one exception. If one (and only one)
argument of some function $f$ is form-valued $\omega=a d x + b d y$ then
\grg\ applies $f$ to the algebraic
multipliers of the form $f(\omega) = f(a) d x+ f(b) d y$.
The same rule works for vector-valued arguments.
Let us consider the example in the \reduce\
operator \comm{LIMIT} is applied to the
form-valued expression
\begin{slisting}
<- Coordinates t, x, y, z;
<- www=(x+y)\^2/(x\^2-1)*d x+(x+y)/(x-z)*d y;
<- www;

   2            2
  x  + 2*x*y + y            x + y
(-----------------) d x + (-------) d y
       2                    x - z
      x  - 1

<- LIMIT(www,x,INFINITY);

 d x +  d y
\end{slisting}

I would like to remind also that depending on the
particular \reduce\ system \reduce\ operators must be
used in \grg\ in upper \comm{LIMIT} or lower case \comm{limit}.
See page \pageref{case} for more details.

Any function or operator defined in the \reduce\ package
can be used in \grg\ as well. Some examples are
considered in section \ref{packages}.


\subsection{Expression Evaluation}
\index{Expression evaluation}

\grg\ evaluates expressions in several steps:

(1) All \grg-specific constructions such as
\comm{Sum}, \comm{Prod}, \comm{Re}, \comm{Im} etc are
explicitly expanded.

(2) If expression contains components of some built-in
or user defined object they are replaced by the appropriate value.
If the object is in indefinite state
\seethis{See page \pageref{find} about the \comm{Find} command.}
(no value of the object is known) then \grg\ tries to
calculate its value by the method used by the \comm{Find} command.
The automatic object calculation can be prevented by
\swind{AUTO}
turning the switch \comm{AUTO} off.
If due to some reason the object  cannot be calculated then
expression evaluation is terminated with the error message.

(3) After all object components are replaced by their
values \grg\ performs all ``geometrical'' operations: exterior
and interior products, scalar products etc. If expression is
form-valued when it is reduced to the form
$a\,dx^0\wedge dx^1\dots+b\,d x^1\wedge+\dots$ where $a$ and $b$
are algebraic expressions (similarly for the vector-valued expressions).

(4) The \reduce\ algebraic simplification routine
is applied to the algebraic expressions $a$, $b$.
\seethis{In the anholonomic mode the basis $b^i\wedge b^j\dots$
is used instead. See section \ref{amode}.}
Final expression consist of exterior products of basis
coordinate differentials $dx^i\wedge dx^j\dots$ (or basis
vectors $\partial_{x^i}$) multiplied by the algebraic expressions.
The algebraic expressions contain only the coordinates,
constants and functions.

\subsection{Controlling Expression Evaluation}

There are many \reduce\ switches which control
algebraic expression evaluation. The number of these switches
and details of their work depend on the \reduce\ version.
Here we consider some of these switches. All examples below
are made with the \reduce\ 3.5. On other \reduce\ versions
result may be a bit different.

Switches {\tt EXP} and {\tt MCD} control expansion and
reduction of rational expressions to a common denominator
respectively.
\begin{slisting}
<- (x+y)\^2;

 2            2
x  + 2*x*y + y

<- Off EXP;
<- (x+y)\^2;

       2
(x + y)

<- On EXP;
<- 1/x+1/y;

 x + y
-------
  x*y

<- Off MCD;
<- 1/x+1/y;

 -1    -1
x   + y
\end{slisting}
These switches are normally on.

Switches {\tt PRECISE} and {\tt REDUCED} control evaluation of
square roots:\label{PRECISE}\label{REDUCED}
\begin{slisting}
<- SQRT(-8*x\^2*y);

2*SQRT( - 2*y)*x

<- On REDUCED;
<- SQRT(-8*x\^2*y);

2*SQRT(y)*SQRT(2)*I*x

<- Off REDUCED;
<- On PRECISE;
<- SQRT(-8*x\^2*y);

2*SQRT(y)*SQRT(2)*I*x

<- On REDUCED, PRECISE;
<- SQRT(-8*x\^2*y);

2*SQRT(y)*SQRT(2)*ABS(x)
\end{slisting}


Combining rational expressions the system by default
calculates the least common multiple of denominators but
turning the switch {\tt LCM} off prevents this calculation.

Switch {\tt GCD} (normally off) makes the system
search and cancel the greatest common divisor of the
numerator and denominator of rational expressions.
Turning {\tt GCD} on may significantly slow down the
calculations. There is also another switch {\tt EZGCD}
which uses other algorithm for g.c.d. calculation.


Switches {\tt COMBINELOGS} and {\tt EXPANDLOGS} control
the evaluation of logarithms
\begin{slisting}
<- On EXPANDLOGS;
<- LOG(x*y);

LOG(x) + LOG(y)

<- LOG(x/y);

LOG(x) - LOG(y)

<- Off EXPANDLOGS;
<- On COMBINELOGS;
<- LOG(x)+LOG(y);

LOG(x*y)
\end{slisting}

By default all polynomials are considered by \reduce\ as
the polynomials with integer coefficients. The switches
{\tt RATIONAL} and {\tt COMPLEX} allow rational and
complex coefficients in polynomials respectively:
\begin{slisting}
<- (x\^2+y\^2+x*y/3)/(x-1/2);

       2            2
 2*(3*x  + x*y + 3*y )
-----------------------
      3*(2*x - 1)

<- On RATIONAL;
<- (x\^2+y\^2+x*y/3)/(x-1/2);

  2    1         2
 x  + ---*x*y + y
       3
-------------------
           1
      x - ---
           2

<- Off RATIONAL;
<- 1/I;

 1
---
 I

<- (x\^2+y\^2)/(x+I*y);

  2    2
 x  + y
---------
 I*y + x

<- On COMPLEX;
<- 1/I;

 - I

<- (x\^2+y\^2)/(x+I*y);

x - I*y
\end{slisting}
Switch {\tt RATIONALIZE} removes complex numbers from the
denominators of the expressions but it works even if
{\tt COMPLEX} is off.

Turning off switch {\tt EXP} and on {\tt GCD} one can
make the system to factor expressions
\begin{slisting}
<- Off EXP;
<- On GCD;
<- x\^2+y\^2+2*x*y;

       2
(x + y)
\end{slisting}
Similar effect can be achieved by turning on switch {\tt FACTOR}.
Unfortunately this works only when \grg\ prints expressions and
internally expressions remain in the expanded form.
To make \grg\ to work with factored expressions internally one
must turn on {\tt FACTOR} and {\tt AEVAL}.
\swind{AEVAL}
The \grg\ switch {\tt AEVAL} make \grg\ to use an alternative
\reduce\ routine for algebraic expression evaluation and simplification.
This routine works well with {\tt FACTOR} on.
\seethis{See section \ref{tuning} about configuration files.}
Possibly it
is good idea to turn switch {\tt AEVAL} on by default.
This can be done using \grg\ configuration files.

\subsection{Substitutions}
\index{Substitutions}

The substitution commands in \grg\ are the same as the
corresponding \reduce\ instructions
\cmdind{Let}\cmdind{Match}\cmdind{For All Let}
\command{\opt{For All \rpt{\parm{x}}\,\opt{Such That \parm{cond}}} Let \rpt{\parm{sub}};\\\tt
\opt{For All \rpt{\parm{x}}\,\opt{Such That \parm{cond}}} Match \rpt{\parm{sub}};}
\seethis{See page \pageref{solutions} about solutions.}
where \parm{sub} is either relation {\tt \parm{l}\,=\,\parm{r}}
or the solution in the form \comm{Sol(\parm{n})}.
After the substitution is activated every appearance of \parm{l} will be
replaced by \parm{r}. The {\tt For All} substitutions have additional list
of parameters \parm{x} and will work for any value
of \parm{x}. The optional condition \parm{cond} imposes restrictions
on the value of the parameters \parm{x}. The \parm{cond} is
the boolean expression (see page \pageref{bool}).

The substitution can be deactivated by the command
\cmdind{Clear}
\command{\opt{For All \rpt{\parm{x}}\,\opt{Such That \parm{cond}}} Clear \rpt{\parm{sub}};}
Notice that the variables \parm{x} must be exactly the same
as in the corresponding {\tt For All Let} command.

The difference between \comm{Match} and \comm{Let}
is that the former matches the degrees of the
expressions exactly while \comm{Let} matches all powers which
are greater than one indicated in the substitution:
\begin{slisting}
<- Const a;
<- (a+1)\^8;

 8      7       6       5       4       3       2
a  + 8*a  + 28*a  + 56*a  + 70*a  + 56*a  + 28*a  + 8*a + 1

<- Let a\^3=1;
<- (a+1)\^8;

    2
85*a  + 86*a + 85

<- Clear a\^3;
<- Match a\^3=1;
<- (a+1)\^8;

 8      7       6       5       4       2
a  + 8*a  + 28*a  + 56*a  + 70*a  + 28*a  + 8*a + 57
\end{slisting}

Substitutions can be used for various purposes, for example:
(i) to define additional mathematical relations such as
trigonometric ones;
(ii) to ``assign'' value to the user-defined and built-in constants;
(iii) to define differentiation rules for functions.

After some substitution is activated it applies to every
evaluated expression but value of the objects calculated
\emph{before} remain unchanged.
The command \comm{Evaluate} re-simplifies the value of the object
\cmdind{Evaluate}
\command{Evaluate \parm{object};}
here \parm{object} is the object name, or identifier, or the
group object name.
Let us consider a simple \grg\ task which
calculates the volume 4-form of some metric
\begin{slisting}
<- Coordinates t, x, y, z;
<- Constant a;
<- Tetrad T0=d t, T1=d x, T2=SIN(a)*d y+COS(a)*d z,
          T3=-COS(a)*d y+SIN(a)* d z;
<- Find and Write Volume;
Volume :

              2         2
VOL =  (SIN(a)  + COS(a) ) d t \w\ d x \w\ d y \w\ d z
\end{slisting}
We see that \reduce\ do not know the
appropriate trigonometric rule.
Thus we are going to apply substitution
\begin{slisting}
<- For all x let SIN(x)\^2 = 1-COS(x)\^2;
<- Write Volume;
Volume :

VOL =  d t \w\ d x \w\ d y \w\ d z
\end{slisting}
The situation has been improved.
But actually, the \emph{internal} representation
of {\tt VOL} remains unchanged. {\tt Write} by default
re-simplifies expressions before printing.
\swinda{WRS}
By turning switch {\tt WRS} off we can prevent this
re-simplification:
\begin{slisting}
<- Off WRS;
<- Write Volume;
Volume :
              2         2
VOL =  (SIN(a)  + COS(a) ) d t \w\ d x \w\ d y \w\ d z
\end{slisting}
Now we can apply \comm{Evaluate}:
\begin{slisting}
<- Evaluate Volume;
<- Write Volume;
Volume :

VOL =  d t \w\ d x \w\ d y \w\ d z
\end{slisting}
We see that the internal value of {\tt VOL} now has been
replaced by re-simplified expression.

Notice that the command
\command{Evaluate All;}
applies \comm{Evaluate} to all objects whose value is
currently known.

\subsection{Generic Functions}
\index{Generic Functions}\label{genfun}

Unfortunately \reduce\ lacks the notion of partial derivative of a function.
The expression \comm{DF(f(x,y),x)} is treated by \reduce\ as the
``derivative of the expression \comm{f(x,y)} with respect to
the variable \comm{x}''  rather than  the ``derivative of the function
\comm{f} with respect to its first argument''.
Due to this \reduce\ cannot handle
chain differentiation rule etc. This problem is fixed by the
package \file{dfpart} written by H.~Melenk.
This package introduces notion of generic function and
partial derivative \comm{DFP}. If \file{dfpart} is installed
on your \reduce\ system \grg\ provides the interface
to these facilities.



Let us consider an example. First we declare
one usual and two generic functions
\begin{slisting}
<- Coordinates t, x, y, z;
<- Function f;
<- Generic Function g(a,b), h(b);
<- Write Functions;
Functions:

g*(a,b) h*(b) f
\end{slisting}
Generic functions  must be always declared with
the list of parameters (\comm{a} and \comm{b} in our example).
These parameters play the role of labels which denotes
arguments of the generic function and the partial
derivatives with respect to these arguments
are defined. Due to this generic functions allow the
chain differentiation rule
\begin{slisting}
<- DF(f(SIN(x),y),x);

DF(f(SIN(x),y),x)

<- DF(g(SIN(x),y),x);

COS(x)*g (SIN(x),y)
        a
\end{slisting}
Here subscript \comm{a} denotes
the derivative of the function \comm{g} with respect to the
first argument.  \enlargethispage{5mm}
The operator \comm{DFP} is introduced to denotes such
derivatives in expressions:
\begin{slisting}
<- DF(g(x,y)*h(y),b);

0

<- DFP(g(x,y)*h(y),b);

g (x,y)*h(y) + h (y)*g(x,y)
 b              b
\end{slisting}

\newpage

If switch \swind{DFPCOMMUTE}
\comm{DFPCOMMUTE} is turned on then \comm{DFP}
derivatives commute.


\section{Using Built-in Formulas In Calculations}

\grg\ has large number of built-in objects and almost
each object has built-in formulas or so called
\emph{ways of calculation} which can be used to find
the value of the object. This section explains how
these formulas (ways) can be used.

\subsection{\comm{Find} Command}
\index{Ways of calculation}\cmdind{Find}\label{find}

Almost each \grg\ built-in object has associated
\emph{ways of calculation}. Each way is nothing but
a formula or equation which allows to compute
the value of the object. All these formulas
are described in the usual mathematical style in
chapter 3.
The command\cmdind{Show \parm{object}}
\command{Show \parm{object};}
or equivalently
\command{?~\parm{object};}
prints information about object's ways of calculation.

The command \comm{Find} applies built-in formulas to
calculate the object value
\command{Find \parm{object} \opt{\parm{way}};}
where \parm{object} is the object name, or identifier, or
group object name.
The optional specification \parm{way} indicates the
particular way if the \parm{object} has several built-in ways
of calculation.

\enlargethispage{3mm}

Consider the curvature 2-form $\Omega^a{}_b$
(object \comm{Curvature}, id. \comm{OMEGA}):
\begin{slisting}
<- Show Curvature;

Curvature OMEGA'a.b is 2-form
  Value: unknown
  Ways of calculation:
    Standard way (omega)
    From spinorial curvature (OMEGAU*,OMEGAD)
\end{slisting}

\noindent
We can see that this object has two built in ways of
calculation. First way named {\tt Standard way} is the
usual equation
$\Omega^a{}_b=d\omega^a{}_b+\omega^a{}_m\wedge\omega^m{}_b$.
Second way under the name {\tt From spinorial curvature}
uses spinor $\tsst$ tensor relationship to compute the curvature 2-form
using its spinor analogues  $\Omega_{AB}$ and
$\Omega_{\dot{A}\dot{B}}$ as the source data.
The ways of calculation are printed by the command {\tt Show}
in the form
\command{\parm{wayname} (\rpt{\parm{SI}})}
where \parm{wayname} is the way name and \seethis{See Eq. (\ref{omes}) on \pref{omes}.}
the \parm{SI} are the identifiers of the \emph{source} objects which are
present in the right-hand side of the equation. The value of
these objects must be known before the formula can be applied.

%\enlargethispage{5mm}

The \parm{way} in the \comm{Find} command allows one to
choose the particular way which can be done by two methods.
In the first form \parm{way} is just the name exactly as
it printed by the \comm{Show} command
\command{wayname}
or {\tt Using standard way} or {\tt By standard way} if the way
name is {\tt Standard way}. Another method to specify
the way is to indicate the appropriate source object
\command{From \parm{object}\\\tt%
Using \parm{object}}
where \parm{object} is the name  or the identifier of the source object.
For example second (spinorial) way of calculation for the curvature
2-form can be chosen by the following equivalent commands \vspace{-1mm}
\begin{listing}
   Find curvature from spinorial curvature;
   Find curvature using OMEGAU;
\end{listing}
while first way is activated by the commands \vspace*{-1mm}
\begin{listing}
   Find curvature by standard way;
   Find curvature using omega;
\end{listing}
Recall that object identifiers are case sensitive
and \comm{omega} is the identifier
of the frame  connection 1-form $\omega^a{}_b$ and should not be
confused with \comm{OMEGA}.


The \parm{way} specification in the \comm{Find}
can be omitted and in this case
\grg\ uses the following algorithm to choose
a particular way of calculation. Observe that the identifier
of the undotted curvature 2-form $\Omega_{AB}$ is marked
by the symbol $*$. This label marks so called \emph{main}
objects. If no way of calculation is specified when
\grg\ tries to choose the way, browsing the way list
form top to the bottom, for which the value of the \emph{main}
object is already known. If no switch way exists then
\grg\ just picks up the first way in the list.
Therefore in our example the command
\begin{listing}
   Find curvature;
\end{listing}
will use the second way if the value of the object $\Omega_{AB}$
(id. \comm{OMEGAU}) is known and second way otherwise.

As soon as some way of calculation is chosen \grg\ tries to
calculate the values of the source objects which are present
in the right-hand side of corresponding equations.
\grg\ tries to do this by applying the \comm{Find} command without way
specification to these objects. Thus a single \comm{Find}
can cause quite long chain of calculations.
This recursive work is reflected by the appropriate
tracing messages. The tracing can be eliminated by turning off
switch \comm{TRACE}.\swind{TRACE}

Here we present the sample \grg\ session which computes
curvature 2-form for the flat gravitational waves
\begin{slisting}

<- Cord u, v, z, z~;

z & z~ - conjugated pair.

<- Null Metric;
<- Function H(u,z,z~);
<- Frame T0=d u, T1=d v+H*d u, T2=d z, T3=d z~;
<- ds2;

   2                2
 ds  =  ( - 2*H) d u  + (-2) d u d v + 2 d z d z~

<- Find Curvature;
Sqrt det of metric calculated. 0.16 sec
Volume calculated. 0.16 sec
Vector frame calculated From frame. 0.16 sec
Inverse metric calculated From metric. 0.16 sec
Frame connection calculated. 0.22 sec
Curvature calculated. 0.22 sec
<- Write Curvature;
Curvature:

     1
OMEGA   = ( - DF(H,z,2)) d u \w d z + ( - DF(H,z,z~)) d u \w d z~
      2

     1
OMEGA   = ( - DF(H,z,z~)) d u \w d z + ( - DF(H,z~,2)) d u \w d z~
      3

     2
OMEGA   = ( - DF(H,z,z~)) d u \w d z + ( - DF(H,z~,2)) d u \w d z~
      0
\newpage
     3
OMEGA   = ( - DF(H,z,2)) d u \w d z + ( - DF(H,z,z~)) d u \w d z~
      0
\end{slisting}


Finally we want to emphasize that ways associated
with some object may depend on the concrete environment.
In particular the {\tt Standard way} for
the curvature 2-form is always available but second
way which is essentially related to spinors works
\seethis{See \pref{spinors} about the spinorial formalism.}
only in the 4-dimensional spaces of Lorentzian signature
and iff the metric is null.
If some way is not valid in the current environment
it simply disappears from the way list printed by the \comm{Show}.

It should be noted also that the \comm{Find \parm{object};}
command works only if the \parm{object} is in the indefinite state
and is rejected if the value of the \parm{object} is already known.
If you want to re-calculate the object then previous value must be
cleared by the \comm{Erase} command.

\subsection{\comm{Erase} command}
\cmdind{Erase}

The command
\command{Erase \parm{object};}
destroys the \parm{object} value and returns it to initial
indefinite state. It can be used also to free the
memory.

\subsection{\comm{Zero} command}
\cmdind{Zero}

Command
\command{Zero \parm{object};}
assigns zero values to all \parm{object} components.

\subsection{\comm{Normalize} command}
\cmdind{Normalize}

Command
\command{Normalize \parm{object};}
applies to equations. It replaces equalities
of the form $l=r$ by the equalities $l-r=0$
and re-simplifies the result.

\subsection{\comm{Evaluate} command}
\cmdind{Evaluate}

The command
\command{Evaluate \parm{object};}
re-simplifies existing value of the \parm{object}.
This command is useful if we want to apply new substitutions
\seethis{See page \pageref{subs} about substitutions.}
to the object whose value is already known.
The command
\command{Evaluate All;}
re-simplifies all objects whose value is currently known.


\section{Printing Result of Calculations}

\subsection{\comm{Write} Command}
\cmdind{Write}

The command
\command{Write \parm{object};}
prints value of the \parm{object}. Here \parm{object}
id the object name or identifier.\index{Group name}
Group names denoting a collection of several objects
\seethis{See page \pageref{macro} about macro objects.}
and macro object identifiers can be used in the \comm{Write}
command as well. In addition word \comm{All}
can be used to print all currently known objects.


The command \comm{Write} can print declarations as well if
\parm{object} is {\tt functions}, {\tt constants}, or
{\tt affine parameter}.


The command
\command{Write \rpt{\parm{object}}~to~"\parm{file}";}
or equivalently
\command{Write \rpt{\parm{object}}~>~"\parm{file}";}
writes result into the \comm{"\parm{file}"}. Notice
that \comm{Write} always destroys previous contents of the
file. Therefore we have another command
\command{Write to "\parm{file}";\\\tt%
Write > "\parm{file}";}
which redirects all output into the file. The standard output
can be restored by the commands\cmdind{End of Write}\cmdind{EndW}
\command{EndW;\\\tt%
End of Write;}

\enlargethispage{3mm}

By default \comm{Write} re-simplifies the expressions
before printing them.  \swind{WRS}
\seethis{See page \pageref{subs} about substitutions.}
This is convenient when substitutions are activated
but slows down the printing especially for very large
expressions. The re-simplification can be abolished
by turning off switch \comm{WRS}.
If switch \comm{WMATR} is turned on then
\swind{WMATR}
\grg\ prints all 2-index scalar-valued objects in
the matrix form
\begin{slisting}
<- Coordinates t, x, y, z;
<- On wmatr;
<- Find and Write metric;
Assuming Default Metric.
Metric calculated By default. 0.06 sec
Metric:

[-1  0  0  0]
[           ]
[0   1  0  0]
[           ]
[0   0  1  0]
[           ]
[0   0  0  1]
\end{slisting}


\comm{Write} prints frame, spinor and enumerating indices as
numerical subscripts while holonomic indices are printed as
the coordinate identifiers. If frame is holonomic
and there is no difference between frame and coordinate indices then
by default all frame indices are also labelled by the
appropriate identifiers. But is switch \comm{HOLONOMIC} \swinda{HOLONOMIC}
is turned off they are still printed as numbers.

\subsection{\comm{Print} Command}
\cmdind{Print}

The \comm{Write} command described in the previous section
prints value of an object. This value must be
calculated beforehand by the \comm{Find} command
or established by the assignment.
The command \comm{Print} evaluates expression and
immediately prints its value. It has several forms
\command{%
\opt{Print} \parm{expr} \opt{For \parm{iter}};\\\tt
For \parm{iter} Print \parm{expr};}
Here \parm{expr} is expression to be evaluated and
\parm{iter} indicates that expression must be
evaluated for several value of some variable.
The specification \parm{iter} is completely the same as
is the \comm{Sum} expression and is described in details
in section \ref{iter} on page \pageref{iter}.
It consists of the list of parameters
separated by commas \comm{,} or relational operators
{\tt < > => =<}. For example the command
\begin{listing}
   G(a,b) for a<b;
\end{listing}
prints off-diagonal components of the metric.

Both word \comm{Print} and \comm{For} parts
of the command can be omitted and it is possible just to
enter an expression
\command{\parm{expr};}
and it will be evaluated and printed.
The expression can contain indefinite identifiers
and by default \grg\ treats them similarly
to the variables in the \comm{For} part of the \comm{Print}
command. The range of such parameters are determined
by the short summation variable specification as explained
on page \pageref{siter}.
For example the following four commands are equivalent.
they all print the components of the holonomic metric $g_{\alpha\beta}$
\begin{listing}
   Print g(a,b) for a,b;
   For a,b Print g(a,b);
   g(a,b) for a,b;
   g(a,b);
\end{listing}
Here the parameters \comm{a}, \comm{b} run from 0 to $d-1$.

Unfortunately such treatment of unknown variables
may create some confusion since occasionally
misprinted identifier may be recognizes by \grg\ as an
iteration variable. If switch\swind{NOFREEVARS}
\comm{NOFREEVARS} is turned on then \grg\
becomes more scrupulous and any unknown variable
will cause the error.


\subsection{Controlling the Output}

There are several switches and commands which allow one to
change output form of expressions. One needs to
stress that all these facilities have no influence on the
\emph{internal form} of expressions, they alter the \emph{printout
only}.

\enlargethispage{2mm}

Switches {\tt ALLFAC} and command {\tt Factor}
control factoring of subexpressions. In the on default position
{\tt ALLFAC} makes the system search for a common factor
and print it outside the expression.  The command\cmdind{Factor}
\command{Factor \rpt{\parm{expr}};}
makes the system collect together terms with
different powers of subexpressions \parm{expr}.
Command\cmdind{RemFac}
\command{RemFac \rpt{\parm{expr}};}
removes the action of the previous {\tt Factor} command.
\begin{slisting}
<- Constants a,b,c;
<- a*(a+b+1)\^2;
\newpage
    2                  2
a*(a  + 2*a*b + 2*a + b  + 2*b + 1)

<-  Off ALLFAC;
<-  a*(a+b+1)\^2;

 3      2        2      2
a  + 2*a *b + 2*a  + a*b  + 2*a*b + a

<-  Factor b;
<-  a*(a+b+1)\^2;

 2           2           3      2
b *a + b*(2*a  + 2*a) + a  + 2*a  + a

<-  On ALLFAC;
<-  a*(a+b+1)\^2;

 2                         2
b *a + 2*b*a*(a + 1) + a*(a  + 2*a + 1)
\end{slisting}

Normally \reduce\ prints terms in some canonical order.
The switch {\tt REVPRI} prints terms in reverse order and
command\cmdind{Order}
\command{Order \rpt{\parm{expr}};}
specifies the required order of subexpressions explicitly.
\begin{slisting}
<-  Constants a,b,c;
<-  (a+b*c)\^3;

 3      2            2  2    3  3
a  + 3*a *b*c + 3*a*b *c  + b *c

<-  On REVPRI;
<-  (a+b*c)\^3;

 3  3        2  2      2        3
b *c  + 3*a*b *c  + 3*a *b*c + a

<-  Order c,a,b;
<-  (a+b*c)\^3;

 3        2        2    2    3  3
a  + 3*c*a *b + 3*c *a*b  + c *b

<-  Off REVPRI;
<-  (a+b*c)\^3;

 3  3      2    2        2      3
c *b  + 3*c *a*b  + 3*c*a *b + a
\end{slisting}

By default \reduce\ prints fractions in two-dimensional format
but turning off switch {\tt RATPRI} prevents this facility.
Switch {\tt DIV} in the on position makes the system divide
each term of the numerator by the denominator and to print
the denominator in the form of negative powers. Switch {\tt RAT}
works in combination with the {\tt Factor} command. In the
on position it makes the system divide each term collected by the
{\tt Factor} in the numerator by the denominator.
\begin{slisting}
<-  Const a,b,c;
<-  (a+b+1)\^2/a;

  2                  2
 a  + 2*a*b + 2*a + b  + 2*b + 1
---------------------------------
                a

<-  Off RATPRI;
<-  (a+b+1)\^2/a;

  2                  2
(a  + 2*a*b + 2*a + b  + 2*b + 1)/a

<-  On DIV;
<-  (a+b+1)\^2/a;

     -1  2      -1      -1
a + a  *b  + 2*a  *b + a   + 2*b + 2

<-  Factor b;
<-  (a+b+1)\^2/a;

 2  -1         -1             -1
b *a   + 2*b*(a   + 1) + a + a   + 2

<-  Off DIV;
<-  (a+b+1)\^2/a;

  2                  2
(b  + 2*b*(a + 1) + a  + 2*a + 1)/a

<-  On RAT;
<-  (a+b+1)\^2/a;

 2                       2
b /a + 2*b*(a + 1)/a + (a  + 2*a + 1)/a

<-  On RATPRI;
<-  (a+b+1)\^2/a;

  2                    2
 b          a + 1     a  + 2*a + 1
---- + 2*b*------- + --------------
 a            a            a
\end{slisting}

One needs to realize that output form transformations
may require a long time and memory expense. There is a
special switch {\tt PRI} which allows one to minimize this
expense. If {\tt PRI} is turned off then
the system will print all expressions exactly in their
internal form and output control does not work.
This is the fastest way to print result of calculations.

The command\cmdind{Line Length} \comm{Line Length \parm{n};}
sets the output line length to \parm{n}.


\subsection{\LaTeX\ and Graphics Output}
\index{LaTeX@\LaTeX\ output mode}\index{Graphics output mode}

Some versions of \reduce\ running under Windows,
OS/2 or X-windows are equipped with the graphic shells
which provide book-style output with Greek characters,
integral signs etc. \grg\ is compatible
with these systems.\swind{FANCY}
This graphic regime is activated by switch \comm{FANCY}.

Graphic output mode internally uses some subset
of the \LaTeX\ language.\swind{LATEX}
Switch \comm{LATEX} makes \grg\ to print the output in the
\LaTeX\ format. This output can be written into a file and
later directly inserted in a document.
Notice that turning off switch \comm{LATEX} returns
graphic output mode with switch \comm{FANCY} on while
turning off \comm{FANCY} automatically turns off
\comm{LATEX} as well and returns usual character output mode.

In graphic regime the derivatives are printed in
$\partial f/\partial x$ notation. \swind{DFINDEXED}
Switch \comm{DFINDEXED} makes the system to print
derivatives in the indexed notation $f_x$.

The following expressions is the scalar curvature of the
Bondi metric obtained by \grg\ and directly inserted in
this manual
\begin{eqnarray*}
R &= &
\bigl(4\,e^{2\,\beta\,+\,2\,\gamma}\,\cos(\theta)\,\frac{\partial\,U}{\partial\,r}\,r^2\,-\,8\,e^{4\,\beta}\,\cos(\theta)\,\frac{\partial\,\beta}{\partial\,\theta}\,-\,\\
&&4\,e^{2\,\beta\,+\,2\,\gamma}\,\cos(\theta)\,\frac{\partial\,\gamma}{\partial\,r}\,U\,r^2\,+\,12\,e^{4\,\beta}\,\cos(\theta)\,\frac{\partial\,\gamma}{\partial\,\theta}\,+\,\\
&&12\,e^{2\,\beta\,+\,2\,\gamma}\,\cos(\theta)\,U\,r\,+\,4\,e^{2\,\beta\,+\,2\,\gamma}\,\frac{\partial^2\,U}{\partial\,r\,\partial\,\theta}\,\sin(\theta)\,r^2\,+\,\\
&&e^{4\,\gamma}\,(\frac{\partial\,U}{\partial\,r})^2\,\sin(\theta)\,r^4\,+\,4\,e^{2\,\beta\,+\,2\,\gamma}\,\frac{\partial\,U}{\partial\,r}\,\frac{\partial\,\beta}{\partial\,\theta}\,\sin(\theta)\,r^2\,+\,\\
&&4\,e^{2\,\beta\,+\,2\,\gamma}\,\frac{\partial\,U}{\partial\,\theta}\,\frac{\partial\,\gamma}{\partial\,r}\,\sin(\theta)\,r^2\,+\,12\,e^{2\,\beta\,+\,2\,\gamma}\,\frac{\partial\,U}{\partial\,\theta}\,\sin(\theta)\,r\,-\,\\
&&4\,e^{2\,\beta\,+\,2\,\gamma}\,\frac{\partial^2\,V}{\partial\,r^2}\,\sin(\theta)\,r\,-\,8\,e^{2\,\beta\,+\,2\,\gamma}\,\frac{\partial\,V}{\partial\,r}\,\frac{\partial\,\beta}{\partial\,r}\,\sin(\theta)\,r\,-\,\\
&&8\,e^{2\,\beta\,+\,2\,\gamma}\,\frac{\partial\,V}{\partial\,r}\,\sin(\theta)\,+\,8\,e^{2\,\beta\,+\,2\,\gamma}\,\frac{\partial^2\,\beta}{\partial\,r\,\partial\,\theta}\,\sin(\theta)\,U\,r^2\,-\,\\
&&8\,e^{2\,\beta\,+\,2\,\gamma}\,\frac{\partial^2\,\beta}{\partial\,r^2}\,\sin(\theta)\,V\,r\,+\,8\,e^{2\,\beta\,+\,2\,\gamma}\,\frac{\partial\,\beta}{\partial\,r}\,\sin(\theta)\,V\,-\,\\
&&8\,e^{4\,\beta}\,\frac{\partial^2\,\beta}{\partial\,\theta^2}\,\sin(\theta)\,-\,12\,e^{4\,\beta}\,(\frac{\partial\,\beta}{\partial\,\theta})^2\,\sin(\theta)\,+\,16\,e^{4\,\beta}\,\frac{\partial\,\beta}{\partial\,\theta}\,\frac{\partial\,\gamma}{\partial\,\theta}\,\sin(\theta)\,-\,\\
&&8\,e^{2\,\beta\,+\,2\,\gamma}\,(\frac{\partial\,\gamma}{\partial\,r})^2\,\sin(\theta)\,V\,r\,+\,8\,e^{2\,\beta\,+\,2\,\gamma}\,\frac{\partial\,\gamma}{\partial\,r}\,\frac{\partial\,\gamma}{\partial\,\theta}\,\sin(\theta)\,U\,r^2\,+\,\\
&&4\,e^{4\,\beta}\,\frac{\partial^2\,\gamma}{\partial\,\theta^2}\,\sin(\theta)\,-\,8\,e^{4\,\beta}\,(\frac{\partial\,\gamma}{\partial\,\theta})^2\,\sin(\theta)\,+\,4\,e^{4\,\beta}\,\sin(\theta)\bigr)/\\
&&\bigl(2\,e^{4\,\beta\,+\,2\,\gamma}\,\sin(\theta)\,r^2\bigr)
\end{eqnarray*}



\subsection{Exporting Data Into Other Systems}
\index{Output modes}

Capabilities of major modern computer algebra systems are
approximately equivalent but not quite. One system is better
in doing one things and other is better for other
purposes. It may happen that tools which you need
are available only in one particular systems.
\grg\ provides quite unique facility to export the
data into other computer algebra systems.
Turning on one of the following switches
establishes the \emph{output mode} in which all expressions
are printed in the \emph{input} language of other CAS.
This output can be saved into a file
and later you can use this CAS to proceed you analysis
of the data. At present \grg\ supports five
output modes which are controlled by the switches
\swind{MACSYMA}\swind{MAPLE}\swind{MATH}\swind{REDUCE}\swind{GRG}
\begin{tabular}{ll}
\comm{MACSYMA} & for \macsyma         \\
\comm{MAPLE}   & for \maple           \\
\comm{MATH}    & for \mathematica     \\
\comm{REDUCE}  & for \reduce          \\
\comm{GRG}     & for \grg             \\
\end{tabular}\newline
Notice the last switch allows one to print the data
in the form which can be later inserted into \grg\ task.

\section{Advanced Facilities}

\subsection{Solving Equations}
\cmdind{Solve}\label{solutions}

\grg\ provides simple interface to the \reduce\ algebraic
equation solver. The command
\command{Solve \rpt{\parm{l}=\parm{r}}~for~\rpt{\parm{expr}};}
resolves equations \comm{\parm{l}=\parm{r}} with respect
to expressions \parm{expr}. This command has also
other form
\command{Solve \parm{equation} for \rpt{\parm{expr}};}
where \parm{equation} is the name or identifier of
some built-in or user-defined equation.
Both form of the \comm{Solve} command works with
form and scalar valued equations as well but \parm{expr}
must be algebraic. The resulting solutions
are stored in the special object \comm{Solutions}
(identifier \comm{Sol}).
They can be printed by the command\cmdind{Write}\cmdindx{Write}{Solutions}
\command{Write Solutions;}
Left and right hand sides of \parm{n}'th solution can be used
in expression as \comm{LHS(Sol(\parm{n}))}
or \comm{RHS(Sol(\parm{n}))}. The expression \comm{Sol(\parm{n})}
referring to the \parm{n}'th solution can be used in the
\comm{SUB} and \comm{Let} substitutions as well:
\begin{slisting}
<- Coordinates t, x, y, z;
<- Solve x^2-2*x=5, y=9 for x, y;
<- Write Solutions;
Solutions:

Sol(0) : y = 9

Sol(1) : x =  - SQRT(6) + 1

Sol(2) : y = 9

Sol(3) : x = SQRT(6) + 1

<- SUB(Sol(1),(x-1)^2);

6

<- Let Sol(3);
<- (x-1)^2;

6
\end{slisting}

Solutions can be cleared by the command
\cmdind{Erase}\cmdindx{Erase}{Solutions}
\command{Erase Solutions;}
One need to stress that \comm{Solve} is capable to solve algebraic
relations only.
Solving algebraic relations \reduce\ knows already that
the function \comm{ASIN} is inverse to \comm{SIN}.
The command\cmdind{Inverse}
\command{Inverse \parm{f1},\parm{f2};}
tells the system that functions \parm{f1} and \parm{f2}
are inverse to each other.


\subsection{Saving Data for Later Use}
\label{UnloadLoad}

It is very convenient to have facilities to save results of
calculations in a form fitted for restoring and further
manipulation. For this purpose \grg\ has two special commands:
{\tt Unload} and {\tt Load}.

The command\cmdind{Unload}\label{Unload}
\command{Unload \parm{object} > "\parm{file}";\\\tt
Unload \parm{object} To "\parm{file}";}
writes \parm{object} value into \comm{"\parm{file}"} in some
special format.
Here \parm{object} is name or identifier of an object.

The data can be later restored with help of the command\cmdind{Load}
\command{Load "\parm{file}";}

The command {\tt Unload} always overwrites previous \comm{"\parm{file}"}
contents. To save several objects in one file one must use
the following sequence of commands\cmdind{EndU}\cmdind{End of Unload}
\begin{listing}
   Unload > "\parm{file}";
   Unload \parm{object};
   Unload \parm{object};
   ...
   Unload \parm{object};
   End Of Unload;
\end{listing}
Here command \comm{Unload > "\parm{file}";} opens
\comm{"\parm{file}"} and {\tt End Of Unload;} closes it.
The last command has the short form
\command{EndU;}
In fact presented above sequence of commands can be
abbreviated as
\command{Unload \rpt{\parm{object}}~>~"\parm{file}";}

One needs to stress that only the commands {\tt Unload \dots;}
can be used between {\tt Unload > \dots} and
{\tt End Of Unload;}. If this rule does not hold then {\tt Load}
may fail to restore the file.
The only additional command which can be used among these
{\tt  Unload \parm{object};} commands is the comment
{\tt \% \parm{text};}. This command insertes
the comment \parm{text} into the \comm{"\parm{file}"}.
Later when \comm{"\parm{file}"} will be restored by the
{\tt Load} the \parm{text} message will be printed.
This allows one to attach comments  to unreadable files
produced by {\tt Unload} command.

As in other commands \parm{object} in \comm{Unload} command
is either the name or identifier of an object. Names {\tt Coordinates},
{\tt Constants} and {\tt Functions} can also be used to
save declarations. And finally, the command
\command{Unload All > "\parm{file}";}
saves all objects whose value is currently known
\seethis{See section \ref{amode} about anholonomic basis.}
and all declarations. Moreover, in the anholonomic basis mode this
command saves full information about an anholonomic basis.

When data or coordinates declarations are restored from a file
they replace current values. Function and constant declarations
are added to current declarations.

One should realize that serious troubles may appear when different
coordinates are used in the current session and in the restored file.
Even the order of coordinates is extremely important.
We strongly recommend saving all declarations (especially coordinates)
in addition to other objects. It ensures at least that will \grg\ print a
warning message if some contradictions are detected between
current declarations and declarations stored into a file.
The best way to avoid these troubles is to use the command
\command{Unload All > "\parm{file}";}
Loading the file saved by this command at the very beginning of
a new \grg\ task completely restores the previous \grg\ state
with all data and declarations.

Sometimes one needs to prevent the {\tt Load}/{\tt Unload} operations
with coordinates.\swind{UNLCORD}
If switch {\tt UNLCORD} is turned off (normally on)
then all {\tt Load} and {\tt Unload} operations
with coordinates are blocked.

Since {\tt Unload} writes data in human-unreadable form there
is the command\cmdind{Show File}\cmdind{File}\cmdind{Show {"\parm{file}"}}
\command{Show \opt{File} "\parm{file}";}
or equivalently
\command{?~\opt{File}~"\parm{file}";\\\tt
File "\parm{file}";}
which prints short information about objects and declarations
contained in the \comm{"\parm{file}"}.
It also prints comments contained in the file.


\subsection{Coordinate Transformations}
\index{Coordinate transformations}

Command\cmdind{New Coordinates}
\command{New Coordinates \rpt{\parm{new}} with \rpt{\parm{old}=\parm{expr}};}
introduces new coordinates \parm{new} and
defines how old coordinates \parm{old} are expressed in terms
of new ones. If the specified transformation is nonsingular
\grg\ converts all existing objects to the new coordinate system.


The {\tt New Coordinates} command properly transforms all
objects having coordinate indices. The transformation
of frame indices depend on the switch \comm{HOLONOMIC}. \swind{HOLONOMIC}
In general case when frame is not holonomic then objects
having frame indices remain unchanged and only their components
are transformed into the new coordinate system. But if frame
is holonomic then by default all frame indices are transformed
similarly to the coordinate ones. Notice that in such situation
the frame after transformation once again will be holonomic
in the new coordinate system.
But if switch \comm{HOLONOMIC} is turned off the system
distinguishes frame and coordinate indices in spite of the current
frame type. In such situation the holonomic frame
ceases to be holonomic after coordinate transformation.

\subsection{Frame Transformations}
\index{Frame transformations}

Spinorial rotations are performed by
the command\cmdind{Make Spinorial Rotation}\cmdind{Spinorial Rotation}
\command{\opt{Make} Spinorial Rotation \opt{
((\parm{expr}${}_{00}$,\parm{expr}${}_{01}$),
(\parm{expr}${}_{10}$,\parm{expr}${}_{11}$))};}
where expressions $\mbox{\parm{expr}}_{AB}$ comprise the SL(2,C)
transformation matrix
\[
\phi'_A=L_A{}^B\phi_B,\ \
\mbox{\parm{expr}}_{AB}=L_A{}^B
\]

If the specified matrix is really a SL(2,C) one then \grg\
performs appropriate transformation on all objects whose
value is currently known.

Matrix specification in the command can be omitted
\command{\opt{Make} Spinorial Rotation;}
In this case the SL(2,C) matrix $L_A{}^B$ must be specified as
the value of a special object {\tt Spinorial Transformation LS.A'B}
(identifier {\tt LS}).

Command for frame rotation is analogously\cmdind{Make Rotation}\cmdind{Rotation}
\command{\opt{Make} Rotation \opt{
((\parm{expr}${}_{00}$,\parm{expr}${}_{01}$,...),
(\parm{expr}${}_{10}$,\parm{expr}${}_{11}$,...),...)};}
with the nonsingular $d\times d$ rotation matrix
\[
A'^a=L^a{}_bA^b,\ \ \mbox{\parm{expr}}_{ab}=L^a{}_b
\]
\grg\ verifies that this matrix is a valid \emph{rotation}
by checking that frame metric $g_{ab}$ \emph{remains unchanged}
under this transformation
\[
g'_{ab}  = L^m{}_a L^n{}_b g_{mn} = g_{ab}
\]

Once again the matrix specification
can be omitted and transformation $L^a{}_b$ can be specified as the value
of the object {\tt Frame Transformation L'a.b} (identifier {\tt L})
\command{\opt{Make} Rotation;}

Frame rotation commands correctly transform frame and
spinor connection 1-forms.


Finally, there is a special form of the frame
transformation command\cmdind{Change Metric}
\command{Change Metric \opt{
((\parm{expr}${}_{00}$,\parm{expr}${}_{01}$,...),
(\parm{expr}${}_{10}$,\parm{expr}${}_{11}$,...),...)};}
The only difference between this command and {\tt Make Rotation}
is that {\tt Change Metric} does not impose
any restriction on the transformation matrix and
transformed metric does not necessary coincides
with the original one.

Sometimes it is convenient to keep some object unchanged
under the frame transformation. The command\cmdind{Hold}
\command{Hold \parm{object};}
makes the system to keep the \parm{object} unchanged
during frame and spinor transformations. The command\cmdind{Release}
\command{Release \parm{object};}
discards the action of the \comm{Hold} command.


\subsection{Algebraic Classification}
\index{Algebraic classification}

The command\cmdind{Classify}
\command{Classify \parm{object};}
performs algebraic classification of the \parm{object}
specified by its name or identifier.
Currently \grg\ knows algorithms for classifying
the following irreducible spinors

\begin{tabular}{ll}
$X_{ABCD}$ & Weyl spinor type \\
$X_{AB\dot{C}\dot{D}}$ & Traceless Ricci spinor type \\
$X_{AB}$ & Electromagnetic stress spinor type \\
$X_{A\dot{B}}$ & Vector in the spinorial representation
\end{tabular} \newline

\reversemarginpar

The {\tt Classify} command can be applied to any built-in or
user-defined object having one of the listed above
\seethis{See page \pageref{sumspin} about summed spinor indices.}
types of indices. Notice that all spinors must be irreducible
(totally symmetric in dotted and undotted indices)
and $X_{AB\dot{C}\dot{D}}$, $X_{A\dot{B}}$ must be Hermitian.
Groups of the irreducible indices must be represented
as a single summed index.

\normalmarginpar

\grg\ uses the algorithm by F.~W.~Letniowski and R.~G.~McLenaghan
[Gen. Rel. Grav. 20 (1988) 463-483] for Petrov-Penrose
classification of Weyl spinor $X_{ABCD}$. The obvious
simplification of this algorithm is applied to
the spinor analog of electromagnetic strength tensor $X_{AB}$.
The spinor $X_{AB\dot{C}\dot{D}}$ is classified by the algorithm
by G.~C.~Joly, M.~A.~H.~McCallum and W.~Seixas
[Class. Quantum Grav. 7 (1990) 541-556,
Class. Quantum Grav. 8 (1991) 1577-1585].

The classification process is accompanied by the
tracing messages which can be eliminated by turning \swinda{TRACE}
off the switch \comm{TRACE}.
On the contrary if one turns on \swind{SHOWEXPR}
the switch \comm{SHOWEXPR} then \grg\ prints
all expressions which appear during the classification
to let you check whether the decision about
nonvanishing of these expressions is really correct or not.
This facility is important also in classifying
$X_{AB\dot{C}\dot{D}}$ and $X_{A\dot{B}}$
since algebraic type for this objects may depend on
the \emph{sign} of some expressions which
cannot be determined by \grg\ correctly.


\subsection{\reduce\ Packages and Functions in \grg}
\index{Using \reduce\ packages}
\label{packages}

Any procedure or function defined
in \reduce\ package can be used in \grg.
The package must be loaded either before
\grg\ is started or during \grg\ session by one of the
equivalent commands
\cmdind{Package}\cmdind{Use Package}\cmdind{Load}
\command{\opt{Use} Package \parm{package};\\\tt
Load \parm{package};}
where \parm{package} is the package name. Notice that an
identifier must be used for the package name unlike
the \comm{Load "\parm{file}";} command described in \enlargethispage{5mm}
section \ref{UnloadLoad}. Let us consider some examples.
The \reduce\ package \file{specfn} contains
definitions of various special functions and
below we demonstrate 11th Legendre polynomial
\begin{slisting}
<- Coordinates t, x, y, z;
<- package specfn;
<- LEGENDREP(11,x);

           10           8           6          4          2
 x*(88179*x   - 230945*x  + 218790*x  - 90090*x  + 15015*x  - 693)
-------------------------------------------------------------------
                                256
\end{slisting}

\newpage

Another example demonstrates the \file{taylor} package
\begin{slisting}
<- Coordinates t, x, y, z;
<- www=d(E^(x+y)*SIN(x));
<- www;

  x + y                            x + y
(E     *(COS(x) + SIN(x))) d x + (E     *SIN(x)) d y

<- load taylor;
<- TAYLOR(www,x,0,5);

                         y         y
  y      y      y  2    E    4    E    5      6           y      y  2
(E  + 2*E *x + E *x  - ----*x  - ----*x  + O(x )) d x + (E *x + E *x
                        6         15

     y         y
    E    3    E    5      6
 + ----*x  - ----*x  + O(x )) d y
    3         30
\end{slisting}

You can also define your own operators and procedures
in \reduce\ and later use them in \grg.
In the following example file \file{lasym.red} contains
a definition of little \reduce\ procedure
which computes a leading term of asymptotic expansion
of the rational function at large values of some
variable. This file is inputted in \reduce\ before
\grg\ is started
\begin{slisting}

1: in "lasym.red";

procedure leadingterm(w,x);
  lterm(num(w),x)/lterm(den(w),x);

leadingterm

end;

2: load grg;

This is GRG 3.2 release 2 (Feb 9, 1997) ...

System directory: c:{\bs}red35{\bs}grg32{\bs}
System variables are upper-cased: E I PI SIN ...
Dimension is 4 with Signature (-,+,+,+)

<- Coordinates t, r, theta, phi;
<- OMEGA01=(123*r^3+2*r+t)/(r+t)^5*d theta{\w}d phi;
<- OMEGA01;

                      3
                 123*r  + 2*r + t
(-------------------------------------------------) d theta \w d phi
   5      4         3  2       2  3        4    5
  r  + 5*r *t + 10*r *t  + 10*r *t  + 5*r*t  + t

<- LEADINGTERM(OMEGA01,r);

  123
(-----) d theta \w d phi
   2
  r
\end{slisting}


\subsection{Anholonomic Basis Mode}
\index{Anholonomic basis mode}\index{Basis}\label{amode}

\grg\ may work in both holonomic and anholonomic basis modes.
In the first default case, values of all expressions are
represented in a natural holonomic (coordinate) basis:
$d  x^\mu,~d  x^\mu\wedge  x^\nu\dots$ for exterior
forms and $\partial_\mu=\partial/\partial x^\mu$
for vectors. In the second case an
arbitrary basis $b^i=b^i_\mu d  x^\mu$ is used for
forms and inverse vector basis $e_i=e_i^\mu\partial_\mu$ for vectors
($b^i_\mu e^\mu_j=\delta^i_j$). You can specify this basis
assigning a value to built-in object
{\tt Basis} (identifier {\tt b}). If {\tt Basis} is not
specified by user then \grg\ assumes that it coincides
with the frame $b^i=\theta^i$.

Frame should not be confused with basis. Frame $\theta^a$ is used
only for ``external'' purposes to represent tensor indices
while basis $b^i$ and vector basis $e_i$ is used for ``internal''
purposes to represent form and vector valued object components.

The command\cmdind{Anholonomic}
\command{Anholonomic;}
switches the system to the anholonomic basis mode and
the command\cmdind{Holonomic}
\command{Holonomic;}
switches it back to the standard holonomic mode.

Working in anholonomic mode \grg\ creates some internal tables
for efficient calculation of exterior differentiation and
complex conjugation. In anholonomic mode the command
\cmdind{Unload}
\begin{listing}
   Unload All > "\parm{file}";
\end{listing}
automatically saves these tables into the \comm{"\parm{file}"}.
Subsequent\cmdind{Load}
\begin{listing}
   Load "\parm{file}";
\end{listing}
restores the tables and automatically switches the current mode to
anholonomic one. Note that automatic anholonomic mode
saving/restoring works only if {\tt All} is used in
{\tt Unload} command.

One can find out the current mode with the help of the command
\cmdind{Show Status}\cmdind{Status}
\command{\opt{Show} Status;}


\subsection{Synonymy}
\index{Synonymy}

Sometimes \grg\ commands may be rather long. For
instance, in order to find the curvature 2-form $\Omega_{ab}$
from the spinorial curvature $\Omega_{AB}$ and $\Omega_{\dot{A}\dot{B}}$
the following command should be used
\begin{listing}
   Find Curvature From Spinorial Curvature;
\end{listing}
Certainly, this command is clear but typing of such long
phrases may be very dull. \grg\ has synonymy mechanism
which allows one to make input much shorter.

The synonymous words in commands and object names
are considered to be equivalent. The complete list
of predefined \grg\ synonymy is given in appendix D.
Here we present just the most important ones
\begin{verbatim}
   Connection Con
   Constants Const Constant
   Coordinates Cord
   Curvature Cur
   Dotted Do
   Equation Equations Eq
   Find F Calculate Calc
   Functions Fun Function
   Next N
   Show ?
   Spinor Spin Spinorial Sp
   Switch Sw
   Symmetries Sym Symmetric
   Undotted Un
   Write W
\end{verbatim}
Words in each line are considered as equivalent
in all commands. Thus the above command can be abbreviated as
\begin{listing}
   F cur from sp cur;
\end{listing}

Section \ref{tuning} explains how to change built-in synonymy
and how to define a new one.


\subsection{Compound Commands}
\index{Compound commands}

Sometime one may need to perform several consecutive actions
with one object. In this case we can use so called
\emph{compound commands} to shorten the input.
Internally \grg\ replaces each compound command by several usual
ones. For example the compound command
\begin{listing}
   Find and Write Einstein Equation;
\end{listing}
to a pair of usual ones
\begin{listing}
   Find Einstein Equation;
   Write Einstein Equation;
\end{listing}
Actions (commands) can be attached to the end of the
compound command as well:
\begin{listing}
   Find, Write Curvature and Erase It;
\qquad\qquad \udr
   Find \& Write \& Erase Curvature;
\qquad\qquad \udr
   Find Curvature;
   Write Curvature;
   Erase Curvature;
\end{listing}
Note that we have used {\tt ,} and {\tt \&} instead of {\tt and}
in this example. All these separators are equivalent in compound
commands.

Now let us consider the case when one needs to perform a single action
with several objects. The command
\begin{listing}
   Write Frame, Vector Frame and Metric;
\end{listing}
is equivalent to
\begin{listing}
   Write Frame;
   Write Vector Frame;
   Write Metric;
\end{listing}
Way specification can be attached to the {\tt Find} command:
\begin{listing}
   Find QT, QP From Torsion using spinors;
\qquad\qquad \udr
   Find QT From Torsion using spinors;
   Find QP From Torsion using spinors;
\end{listing}
One can combine several actions and several objects.
For example, the command
\begin{listing}
   Find omega, Curvature by Standard Way and Write and Erase Them;
\end{listing}
is equivalent to the sequence of
$(2{\rm\ objects})\times(3{\rm\ commands}) =6$
commands
\begin{listing}
   Find omega by Standard Way;
   Find Curvature by Standard Way;
   Write omega;
   Write Curvature;
   Erase omega;
   Erase Curvature;
\end{listing}
Note that the way specification is attached only to ``left''
commands ({\tt Find} in our case).

The compound commands mechanism works only with
{\tt Find}, {\tt Erase}, {\tt Write} and {\tt Evaluate} commands.

And finally, \grg\ always replaces {\tt Re-\parm{command};} by
{\tt Erase and \parm{command};}. For example
\begin{listing}
   Re-Calculate Maxwell Equations;
\qquad\qquad \udr
   Erase and Calculate Maxwell Equations;
\end{listing}

You can see how \grg\ expand compound commands into the
\swind{SHOWCOMMANDS}
usual ones by turning switch \comm{SHOWCOMMANDS} on.


\section{Tuning \grg}
\label{tuning}

\grg\ can be tuned according to your needs and preferences.
The configuration files allow one to change some default settings
and the environment variable \comm{grg} defines the system
directory which can be used as the depository for
frequently used files.

\subsection{Configuration Files}
\label{configsect}

The configuration files allows one to establish
\begin{list}{$\bullet$}{\labelwidth=8mm\leftmargin=10mm}
\item Default dimension and signature.
\item Initial position of switches.
\item \reduce\ packages which must be preloaded.
\item Synonymy.
\item Default \grg\ start up method.
\end{list}

There are two configuration files. First \emph{global}
configuration file \file{grgcfg.sl} defines the settings
\index{Global configuration file}
during system installation when \grg\ is compiled.
These global settings become permanent and can be changed only
if \grg\ is recompiled. The \emph{local}
configuration file \file{grg.cfg} allows one to override
global settings locally.
\index{Local configuration file}
When \grg\ starts it search the file \file{grg.cfg}
in current directory (folder) and if it is present
uses the corresponding settings.

Below we are going to explain how to change settings in
both global and local configuration files but before
doing this we must emphasize that this need some care.
First, the configuration files use LISP command format
which  differs from  usual \grg\ commands.
Second, is something is wrong with configuration file
then no clear diagnostic is provided.
Finally, if global configuration is damaged you will
not be able to compile \grg. The best strategy is to
make a back-up copy of the configuration files before start
editing them.
Notice that lines preceded by the percent sign
\comm{\%} are ignored by the system (comments).

Both local \file{grg.cfg} and  global \file{grgcfg.sl}
configuration files have similar structure and can include
the following commands.

Command\index{Signature!default}\index{Dimension!default}
\begin{listing}
   (signature!> - + + + +)
\end{listing}
establishes default dimension 5 with the signature
$\scriptstyle(-,+,+,+,+)$. Do not forget \comm{!} and spaces between
\comm{+} and \comm{-}. This command \emph{must be present}
in the global configuration file \file{grgcfg.sl}
otherwise \grg\ cannot be compiled.

The commands
\begin{listing}
   (on!> page)
   (off!> allfac)
\end{listing}
change default switch position. In this example we
turn on the switch \comm{PAGE} (this switch is defined
in DOS \reduce\ only and allows one to scroll back and forth
through input and output) and turn off switch
\comm{ALLFAC}.

The command
\begin{listing}
   (package!> taylor)
\end{listing}
makes the system to load \reduce\ package \file{taylor}
during \grg\ start.

The command of the form\index{Synonymy}
\begin{listing}
  (synonymous!>
    ( affine aff                             )
    ( antisymmetric asy                      )
    ( components comp                        )
    ( unload save                            )
  )
\end{listing}
defines synonymous words. The words in each line will be
equivalent in all \grg\ commands.

Finally the command
\begin{listing}
  (setq ![autostart!] nil)
\end{listing}
alters default \grg\ start up method. It makes sense only
in the global configuration file \file{grgcfg.sl}.
By default \grg\ is launched by single command
\begin{listing}
  load grg;
\end{listing}
which firstly load the program into memory and then
automatically starts it. Unfortunately on some systems
this short method does not work properly: \grg\ shows wrong
timing during computations, the \comm{quit;} command returns
the control to \reduce\ session instead of terminating the
whole program. If the aforementioned option is activated then
\grg\ must be launched by two commands
\begin{listing}
  load grg;
  grg;
\end{listing}
which fixes the problems. Here first command just loads the program
into memory and second one starts it manually. Notice that
one can always use commands
\begin{listing}
  load grg32;
  grg;
\end{listing}
to start \grg\ manually. Command \comm{load grg32;} always
loads \grg\ into memory without starting it independently
on the option under consideration.


\subsection{System Directory}
\index{System directory}

The environment variable \comm{grg} or \comm{GRG}
defines so called \grg\ system directory (folder).
The way of setting this variable is operating system
dependent. For example the following commands
can be used to set \comm{grg} variable in DOS, UNIX and
VAX/VMS respectively:
\begin{listing}
   set grg=d:{\bs}xxx{\bs}yyy{\bs}                {\rm DOS}
   setenv grg /xxx/yyy/               {\rm UNIX}
   define grg SYS$USER:[xxx.yyy]      {\rm VAX/VMS}
\end{listing}
The value of the variable \comm{grg} must point
out to some directory.
In DOS and UNIX the directory
name must include trailing \comm{\bs} or \comm{/}
respectively. The command\cmdind{Show Status}\cmdind{Status}
\command{\opt{Show} Status;}
prints current system directory.

When \grg\ tries to input some batch file containing
\grg\ commands it first searches it in the current working
directory and if the file is absent then it tries
to find it in the system directory. Therefore if you have
some frequently used files you can define the system directory
and move these files there. In this case it is not necessary
to keep them in each working directory. Notice \grg\ uses
the same strategy when opening local configuration file
\file{grg.cfg}. Thus if system directory is defined and it
contains the file \file{grg.cfg} the settings contained in
this file effectively overrides global settings without
recompiling \grg.


\section{Examples}

In this section we want to demonstrate how \grg\ can be applied
to solve simple but realistic problem.
We want to calculate the  Ricci tensor for the Robertson-Walker
metric by three different methods.

First \grg\ task (program)
\begin{listing}
   Coordinates t,r,theta,phi;
   Function a(t);
   Frame T0=d t, T1=a*d r, T2=a*r*d theta, T3=a*r*SIN(theta)*d phi;
   ds2;
   Find and Write Ricci Tensor;
   RIC(\_j,\_k);
\end{listing}
defines the Robertson-Walker metric using the tetrad
formalism with the orthonormal Lorentzian tetrad $\theta^a$.
Using built-in formulas for the Ricci tensor the only one command
is required to accomplish out goal
{\tt Find and Write Ricci Tensor;}. The command {\tt ds2;}
just shows the metric we are dealing with. Notice that
command {\tt Find ...} gives the \emph{tetrad} components of the Ricci
tensor $R_{ab}$. Thus, in addition we print coordinate
components of the tensor $R_{\mu\nu}$ by the command
{\tt RIC(\_j,\_k);}. The hard-copy of the corresponding
\grg\ session is presented below \enlargethispage{4mm}
\begin{slisting}
<- Coordinates t, r, theta, phi;
<- Function a(t);
<- Frame T0=d t, T1=a*d r, T2=a*r*d theta, T3=a*r*SIN(theta)*d phi;
<- ds2;
Assuming Default Metric.
Metric calculated By default. 0.16 sec

   2          2     2     2     2  2         2              2  2  2       2
 ds  =  -  d t  + (a ) d r  + (a *r ) d theta  + (SIN(theta) *a *r ) d phi

<- Find and Write Ricci Tensor;
Sqrt det of metric calculated. 0.21 sec
Volume calculated. 0.21 sec
Vector frame calculated From frame. 0.21 sec
Inverse metric calculated From metric. 0.21 sec
Frame connection calculated. 0.38 sec
Curvature calculated. 0.49 sec
Ricci tensor calculated From curvature. 0.54 sec
Ricci tensor:

          - 3*DF(a,t,2)
RIC   = ----------------
   00          a
\newpage
                                2
         DF(a,t,2)*a + 2*DF(a,t)
RIC   = --------------------------
   11                2
                    a

                                2
         DF(a,t,2)*a + 2*DF(a,t)
RIC   = --------------------------
   22                2
                    a

                                2
         DF(a,t,2)*a + 2*DF(a,t)
RIC   = --------------------------
   33                2
                    a

<- RIC(_j,_k);

            - 3*DF(a,t,2)
j=0 k=0 : ----------------
                 a

                                 2
j=1 k=1 : DF(a,t,2)*a + 2*DF(a,t)

           2                         2
j=2 k=2 : r *(DF(a,t,2)*a + 2*DF(a,t) )

                    2  2                         2
j=3 k=3 : SIN(theta) *r *(DF(a,t,2)*a + 2*DF(a,t) )
\end{slisting}
Tracing messages demonstrate that \grg\ automatically
applied several built-in equations to obtain required value of
$R_{ab}$. The metric          is automatically assumed to be
Lorentzian $g_{ab}={\rm diag}(-1,1,1,1)$.
First \grg\ computed the frame connection 1-form $\omega^a{}_b$.
Next the curvature 2-form $\Omega^a{}_b$ was computed using
standard equation (\ref{omes}) on page \pageref{omes}.
Finally the Ricci tensor was obtained using
relation (\ref{rics}) on page \pageref{rics}.

Second \grg\ task is similar to the first one:
\begin{listing}
   Coordinates t,r,theta,phi;
   Function a(t);
   Metric G00=-1, G11=a^2, G22=(a*r)^2, G33=(a*r*SIN(theta))^2;
   ds2;
   Find and Write Ricci Tensor;
\end{listing}
The only difference is that now we work in the coordinate
formalism by assigning value to the metric rather than
frame. The frame is assumed to be holonomic automatically.
\begin{slisting}
<- Coordinates t, r, theta, phi;
<- Function a(t);
<- Metric G00=-1, G11=a^2, G22=(a*r)^2, G33=(a*r*SIN(theta))^2;
<- ds2;
Assuming Default Holonomic Frame.
Frame calculated By default. 0.11 sec

   2          2     2     2     2  2         2              2  2  2       2
 ds  =  -  d t  + (a ) d r  + (a *r ) d theta  + (SIN(theta) *a *r ) d phi

<- Find and Write Ricci Tensor;
Sqrt det of metric calculated. 0.22 sec
Volume calculated. 0.22 sec
Vector frame calculated From frame. 0.22 sec
Inverse metric calculated From metric. 0.27 sec
Frame connection calculated. 0.33 sec
Curvature calculated. 0.60 sec
Ricci tensor calculated From curvature. 0.60 sec
Ricci tensor:

            - 3*DF(a,t,2)
RIC     = ----------------
    t t          a

                                 2
RIC     = DF(a,t,2)*a + 2*DF(a,t)
    r r

                   2                         2
RIC             = r *(DF(a,t,2)*a + 2*DF(a,t) )
    theta theta

                        2  2                         2
RIC         = SIN(theta) *r *(DF(a,t,2)*a + 2*DF(a,t) )
    phi phi
\end{slisting}
Once again \grg\ uses the same built-in formulas to compute
the Ricci tensor but now all quantities have holonomic
indices instead of tetrad ones.

Finally the third task demonstrate how \grg\ can be used
without built-in equations. Once again we use coordinate
formalism and declare two new objects the Christoffel symbols
\comm{Chr} and Ricci tensor \comm{Ric}
(since \grg\ is case sensitive they are different from the built-in
objects \comm{CHR} and \comm{RIC}). Next we use
well-known equations to compute these quantities
\begin{listing}
   Coordinates t,r,theta,phi;
   Function a(t);
   Metric G00=-1, G11=a^2, G22=(a*r)^2, G33=(a*r*SIN(theta))^2;
   ds2;
   New Chr^a_b_c with s(2,3);
   Chr(j,k,l)= 1/2*GI(j,m)*(@x(k)|G(l,m)+@x(l)|G(k,m)-@x(m)|G(k,l));
   New Ric_a_b with s(1,2);
   Ric(j,k) = @x(n)|Chr(n,j,k) - @x(k)|Chr(n,j,n)
              + Chr(n,m,n)*Chr(m,j,k) - Chr(n,m,k)*Chr(m,n,j);
   Write Ric;
\end{listing}
The hard-copy of the corresponding session is
\begin{slisting}
<- Coordinates t, r, theta, phi;
<- Function a(t);
<- Metric G00=-1, G11=a^2, G22=(a*r)^2, G33=(a*r*SIN(theta))^2;
<- ds2;
Assuming Default Holonomic Frame.
Frame calculated By default. 0.16 sec

   2          2     2     2     2  2         2              2  2  2       2
 ds  =  -  d t  + (a ) d r  + (a *r ) d theta  + (SIN(theta) *a *r ) d phi

<- New Chr^a_b_c with s(2,3);
<- Chr(j,k,l)=1/2*GI(j,m)*(@x(k)|G(l,m)+@x(l)|G(k,m)-@x(m)|G(k,l));
Inverse metric calculated From metric. 0.27 sec
<- New Ric_a_b with s(1,2);
<- Ric(j,k)=@x(n)|Chr(n,j,k)-@x(k)|Chr(n,j,n)+Chr(n,m,n)*Chr(m,j,k)
   -Chr(n,m,k)*Chr(m,n,j);
<- Write Ric;
The Ric:

            - 3*DF(a,t,2)
Ric     = ----------------
    t t          a

                                 2
Ric     = DF(a,t,2)*a + 2*DF(a,t)
    r r
\newpage
                   2                         2
Ric             = r *(DF(a,t,2)*a + 2*DF(a,t) )
    theta theta

                        2  2                         2
Ric         = SIN(theta) *r *(DF(a,t,2)*a + 2*DF(a,t) )
    phi phi
\end{slisting}



\chapter{Formulas}
\parindent=0pt
\arraycolsep=1pt
\parskip=1.6mm plus 1mm minus 1mm

This chapter describes in usual mathematical manner all \grg\
built-in objects and formulas. The description is extremely short
since it is intended for reference only.
If not stated explicitly we use lower case greek letters
${\scriptstyle  \alpha,\beta,\dots}$ for
holonomic (coordinate) indices; ${\scriptstyle a,b,c,d,m,n}$ for
anholonomic frame indices and ${\scriptstyle i,j,k,l}$
for enumerating indices.

To establish the relationship between \grg\ built-in object6s
and mathematical quantities we use the following notation
\[
\mbox{\tt Frame Connection omega'a.b} = \omega^a{}_b
\]
This equality means that there is built-in object named
{\tt Frame Connection} having identifier {\tt omega}
which represent the frame connection 1-form $\omega^a{}_b$.
If the name is omitted then we deal with \emph{macro} object
(see page \pageref{macro}). The notation for indices
in the left-hand side of such equalities is the same
as in the {\tt New object} declaration and
is explained on page \pageref{indices}.

This chapter contains not only definitions of all built-in
objects but all formulas which \grg\ knows and can apply
to find their value. If an object has
several formulas for its computation when each formula
is given together with the corresponding name which is printed
in the typewriter font.
In the case then an object has only one associated
formula the way name is usually omitted.


\section{Dimension and Signature}

Let us denote the space-time dimensionality by $d$
and $n$'th element of the signature specification
${\rm diag}{\scriptstyle(+1,-1,\dots)}$ by ${\rm diag}_n$
($n$ runs from 0 to $d-1$).

There are several macro objects which gives access to
the dimension and signature
\object{dim}{d}
\object{sdiag.idim}{{\rm diag}_i}
\object{sgnt \mbox{=} sign}{s=\prod^{d-1}_{i=0}{\rm diag}_i}
\object{mpsgn}{{\rm diag}_0}
\object{pmsgn}{-{\rm diag}_0}

The macros (two equivalent ones) which give access to
coordinates
\object{X\^m \mbox{=} x\^m}{x^\mu}


\section{Metric, Frame and Basis}

Frame $\theta^a$ and metric $g_{ab}$ plays the
fundamental role in \grg. Together they determine the
space-time line element
\begin{equation}
ds^2 = g_{ab}\,\theta^a\!\otimes\theta^b =
 g_{\mu\nu}\,dx^\mu\!\otimes dx^\nu
\end{equation}

The corresponding objects are
\object{Frame  T'a}{\theta^a=h^a_\mu dx^\mu}
\object{Metric  G.a.b}{g_{ab}}
and ``inverse'' objects are
\object{Vector  Frame D.a}{\partial_a=h^\mu_a\partial_\mu}
\object{Inverse Metric  GI'a'b}{g^{ab}}

The frame can be computed by two ways. First, {\tt By default}
frame is assumed to be holonomic
\begin{equation}
\theta^a = dx^\alpha
\end{equation}
and {\tt From vector frame}
\begin{equation}
\theta^a= |h_a^\mu|^{-1} d x^\mu
\end{equation}

The vector frame can be obtained {\tt From frame}
\begin{equation}
\partial_a= |h^a_\mu|^{-1} \partial_\mu
\end{equation}

The metric can be computed {\tt By default} \index{Metric!default value}
\begin{equation}
g_{ab} = {\rm if}\ a=b\ {\rm then}\ {\rm diag}_a\ {\rm else}\ 0
\end{equation}
or {\tt From inverse metric}
\begin{equation}
g_{ab} = |g^{ab}|^{-1}
\end{equation}

The inverse metric can be computed {\tt From metric}
\begin{equation}
g^{ab} = |g_{ab}|^{-1}
\end{equation}

The holonomic metric $g_{\mu\nu}$ and frame $h^a_\mu$
are given by the macro objects:
\object{g\_m\_n}{g_{\mu\nu}}
\object{gi\^m\^n}{g^{\mu\nu}}
\object{h'a\_m}{h^a_\mu}
\object{hi.a\^m}{h_a^\mu}

The metric determinants and related densities
\object{Det of Metric  detG}{g={\rm det}|g_{ab}|}
\object{Det of Holonomic Metric  detg}{{\rm det}|g_{\mu\nu}|}
\object{Sqrt Det of Metric sdetG}{\sqrt{sg}}

The volume $d$-form
\object{Volume  VOL}{\upsilon = \sqrt{sg}\,\theta^0\wedge\dots\wedge\,\theta^{d-1}
=\frac{1}{d!}{\cal E}_{a_0\dots a_{d-1}}\,\theta^{a_0}\wedge\dots\wedge\,\theta^{a_{d-1}}}

The so called s-forms play the role of basis in the space of the
2-forms
\object{S-forms  S'a'b}{S^{ab}=\theta^a\wedge\theta^b}

The basis and corresponding inverse vector basis are used
when \grg\ works in the anholonomic mode
\seethis{See page \pageref{amode}.}
\object{Basis  b'idim }{b^i=b^i_\mu dx^\mu}
\object{Vector Basis  e.idim }{e_i=b_i^\mu\partial_\mu}
The basis can be computed {\tt From frame}
\begin{equation}
b^i=\theta^i
\end{equation}
or {\tt From vector basis}
\begin{equation}
b^i = |b_i^\mu|^{-1}dx^\mu
\end{equation}
The vector basis can be computed {\tt From basis}
\begin{equation}
e_i = |b^i_\mu|^{-1}\partial_\mu
\end{equation}


\section{Delta and Epsilon Symbols}

Macro objects for Kronecker delta symbols
\object{del\^m\_n}{\delta^\mu_\nu}
\object{delh'a.b}{\delta^a_b}
and totally antisymmetric tensors
\object{eps.a.b.c.d}{{\cal E}_{abcd},\quad{\cal E}_{0123}=\sqrt{sg}}
\object{epsi'a'b'c'd}{{\cal E}^{abcd},\quad{\cal E}_{0123}=\frac{s}{\sqrt{sg}}}
\object{epsh\_m\_n\_k\_l}{{\cal E}_{\mu\nu\kappa\lambda},\quad{\cal E}_{0123}=\sqrt{s\,{\rm det}|g_{\mu\nu}|}}
\object{epsih\^m\^n\^k\^l}{{\cal E}^{\mu\nu\kappa\lambda},\quad{\cal E}_{0123}=\frac{s}{\sqrt{s\,{\rm det}|g_{\mu\nu}|}}}
The definition for epsilon-tensors is given for dimension 4.
The generalization to other dimensions is obvious.


\section{Dualization}

We use the following definition for the dualization
operation. For any $p$-form
\begin{equation}
\omega_p=\frac{1}{p!}\omega_{\alpha_1\dots\alpha_p}dx^{\alpha_1}\wedge
\dots\wedge dx^{\alpha_p}
\end{equation}
the dual $(d-p)$-form is
\begin{equation}
*\omega_p=\frac{1}{p!(d-p)!}{\cal E}_{\alpha_1\dots\alpha_{d-p}}
{}^{\beta_1\dots\beta_p}\,\omega_{\beta_1\dots\beta_p}\,
dx^{\alpha_1}\wedge\dots\wedge dx^{\alpha_{d-p}}
\end{equation}

The equivalent relation which also uniquely defines the $*$
operation is
\begin{equation}
*(\theta^{a_1}\wedge\dots\wedge \theta^{a_p}) =
(-1)^{p(d-p)} \partial_{a_p}\ipr\dots\partial_{a_1}\ipr\,\upsilon
\end{equation}

With such convention we have the following identities
\begin{eqnarray}
**\omega_p &=& s(-1)^{p(d-p)}\,\omega_p \\[0.5mm]
*\upsilon &=& s \\[0.5mm]
*1 &=& \upsilon
\end{eqnarray}


\section{Spinors}
\label{spinors1}

The notion of spinors in \grg\ is restricted to
 4-dimensional spaces of Lorentzian signature ${\scriptstyle(-,+,+,+)}$
or ${\scriptstyle(+,-,-,-)}$ only. In this section  the upper sign relates to the
signature ${\scriptstyle(-,+,+,+)}$ and lower one to
${\scriptstyle(+,-,-,-)}$.

In addition to work with spinors the metric must have the following
form which we call the \emph{standard null metric} \index{Metric!Standard Null}
\index{Standard null metric}\index{Spinors}\index{Spinors!Standard null metric}
\begin{equation}
g_{ab}=g^{ab}=\pm\left(\begin{array}{rrrr}
0  & -1 & 0 & 0 \\
-1 &  0 & 0 & 0 \\
0  &  0 & 0 & 1 \\
0  &  0 & 1 & 0
\end{array}\right)
\end{equation}
Such value of the metric can be established by the command
\cmdind{Null Metric}
{\tt Null metric;}.

Therefore the line-element for spinorial formalism has the form
\begin{equation}
ds^2 = \pm(-\theta^0\!\otimes\theta^1
-\theta^1\!\otimes\theta^0
+\theta^2\!\otimes\theta^3
+\theta^3\!\otimes\theta^2)
\end{equation}

We require also the conjugation rules for this null tetrad (frame) be
\begin{equation}
\overline{\theta^0}=\theta^0,\quad
\overline{\theta^1}=\theta^1,\quad
\overline{\theta^2}=\theta^3,\quad
\overline{\theta^3}=\theta^2
\end{equation}

For such a metric and frame we fix sigma-matrices in the
following form \index{Sigma matrices}
\begin{eqnarray}  \label{sigma}
&&\sigma_0{}^{1\dot{1}}=
\sigma_1{}^{0\dot{0}}=
\sigma_2{}^{1\dot{0}}=
\sigma_3{}^{0\dot{1}}=1 \\[1mm] &&
\sigma^0{}_{1\dot{1}}=
\sigma^1{}_{0\dot{0}}=
\sigma^2{}_{1\dot{0}}=
\sigma^3{}_{0\dot{1}}=\mp1
\end{eqnarray}

The sigma-matrices obey the rules
\begin{eqnarray}
g_{mn}\sigma^m\!{}_{A\dot B}\sigma^n\!{}_{C\dot D} &=&
\mp \epsilon_{AC}\epsilon_{\dot B\dot D} \\[1mm]
\sigma^{aM\dot N}\sigma^b\!{}_{M\dot N} &=& \mp g^{ab}
\end{eqnarray}

The antisymmetric SL(2,C) spinor metric
\begin{equation}
\epsilon_{AB}=\epsilon^{AB}
=\epsilon_{\dot A\dot B}
=\epsilon^{\dot A\dot B}=
\left(\begin{array}{rr}
0 & 1 \\
-1 & 0
\end{array}\right)
\end{equation}
can be used to raise and lower spinor indices
\begin{equation}
\varphi^A=\varphi_B\,\epsilon^{BA},\qquad
\varphi_A=\epsilon_{AB}\,\varphi^B
\end{equation}

The following macro objects represent standard
spinorial quantities
\object{DEL'A.B}{\delta^A_B}
\object{EPS.A.B}{\epsilon_{AB}}
\object{EPSI'A'B}{\epsilon^{AB}}
\object{sigma'a.A.B\cc}{\sigma^a\!{}_{A\dot B}}
\object{sigmai.a'A'B\cc}{\sigma_a{}^{A\dot B}}

The relationship between tensors and spinors
is established by the sigma-matrices
\begin{eqnarray}
X^a &\tsst& X^{A\dot A}=A^a\sigma_a{}^{A\dot A} \\
X_a &\tsst& X_{A\dot A}=A_a\sigma^a\!{}_{A\dot A}
\end{eqnarray}
where sigma-matrices are given by Eq. (\ref{sigma})
We shall denote similar equations by the sign $\tsst$
conserving alphabetical relationship between tensor indices in the
left-hand side and spinorial one in the right-hand side:
$\scriptstyle a\tsst A\dot A$, $\scriptstyle b\tsst B\dot B$.

There is one quite important special case. Any real
antisymmetric tensor $X_{ab}$ are equivalent to the
pair of conjugated irreducible (symmetric) spinors
\begin{eqnarray}
&& X_{ab}=X_{[ab]} \tsst X_{A\dot AB\dot B}=
\epsilon_{AB} X_{\dot A\dot B} + \epsilon_{\dot A\dot B}X_{AB}
\nonumber\\[1mm]
&& X_{AB}=\frac{1}{2}X_{A\dot AB\dot B}\epsilon^{\dot A\dot B},\
   X_{\dot A\dot B}=\frac{1}{2}X_{A\dot AB\dot B}\epsilon^{AB}
\end{eqnarray}
The explicit form of these relations for the sigma-matrices
(\ref{sigma}) is
\begin{equation}
\begin{array}{rclrcl}
X_0 &=& X_{13} & X_{\dot0} &=& X_{12} \\[1mm]
X_1 &=&-\frac{1}{2}(X_{01}-X_{23})\qquad  & X_{\dot1} &=&
-\frac{1}{2}(X_{01}+X_{23})  \\[1mm]
X_2 &=& -X_{02} & X_{\dot2} &=& -X_{03}
\end{array}\label{asys}
\end{equation}
and  the ``inverse'' relation
\begin{equation}
\begin{array}{rclrcl}
X_{01} &=&  -X_1-X_{\dot1},\qquad  &  X_{23} &=& X_1-X_{\dot1},  \\[1mm]
X_{02} &=& -X_2,             &  X_{12} &=& X_{\dot0},  \\[1mm]
X_{03} &=& -X_{\dot 2},      &  X_{13} &=& X_0
\end{array}\label{asyt}
\end{equation}

We shall apply the relations (\ref{asys}) and (\ref{asyt}) to various
antisymmetric quantities. In particular the {\tt Spinorial S-forms}
\object{Undotted S-forms SU.AB}{S_{AB}}
\object{Dotted S-forms SD.AB\cc}{S_{\dot A\dot B}}
The {\tt Standard way} to compute these quantities uses
relations (\ref{asys})
\begin{equation}
 S_{ab}=\theta_a\wedge\theta_b \tsst
\epsilon_{AB} S_{\dot A\dot B} + \epsilon_{\dot A\dot B}S_{AB}
\end{equation}
Spinorial S-forms are self dual
\begin{equation}
*S_{AB}=iS_{AB},\qquad
*S_{\dot A\dot B}=-iS_{\dot A\dot B}
\end{equation}
and exteriorly orthogonal
\begin{equation}
S_{AB}\wedge S_{CD}=-\frac{i}2\upsilon(\epsilon_{AC}\epsilon_{BD}+
\epsilon_{AD}\epsilon_{BC}),\quad S_{AB}\wedge S_{\dot C\dot D}=0
\end{equation}

There is one subtle pint concerning tensor quantities in the
spinorial formalism. Since spinorial null tetrad is complex
with the conjugation rule $\overline{\theta^2}=\theta^3$
all tensor quantities represented in this frame also becomes
complex with similar conjugation rules for any tensor index.
There is special macro object {\tt cci} which performs such
``index conjugation'': {\tt cci{0}=0}, {\tt cci(1)=1},
{\tt cci{2}=3}, {\tt cci(3)=2}. Therefore the correct expression
for the $\overline{\theta^a}$ is {\tt \cc T(cci(a))} but not
{\tt \cc T(a)}.



\section{Connection, Torsion and Nonmetricity}
\label{conn1}

Covariant derivatives and differentials for
quantities having frame and coordinate indices are
\begin{eqnarray}
DX^a{}_b &=& dX^a{}_b
+ \omega^a{}_m\wedge X^m{}_b - \omega^m{}_b\wedge X^a{}_m \\[1mm]
DX^\mu{}_\nu &=& dX^\mu{}_\nu
+ \Gamma^\mu{}_\pi\wedge X^\pi{}_\nu - \Gamma^\pi{}_\nu\wedge X^\mu{}_\pi
\end{eqnarray}

The corresponding built-in connection 1-forms are
\object{Frame Connection omega'a.b}{\omega^a{}_b=\omega^a{}_{b\mu}dx^\mu}
\object{Holonomic Connection GAMMA\^m\_n}
{\Gamma^\mu{}_\nu=\Gamma^\mu{}_{\nu\pi}dx^\pi}

Frame connection can be computed {\tt From holonomic connection}
\begin{equation}
\omega^a{}_b = \Gamma^a{}_b + dh^\mu_b\,h^a_\mu
\end{equation}
and inversely holonomic connection can be obtained
{\tt From frame connection}
\begin{equation}
\Gamma^\mu{}_\nu=\omega^\mu{}_\nu + dh^b_\nu\,h^\mu_b
\end{equation}

By default these connections are Riemannian (i.e. symmetric and
metric compatible). To work with nonsymmetric
connection with torsion the switch \comm{TORSION}\swinda{TORSION}
must be turned on. Then the torsion 2-form is
\object{Torsion THETA'a}{\Theta^a=\frac12Q^a{}_{pq}S^{pq},\quad
Q^a{}_{bc}=\Gamma^a{}_{bc}-\Gamma^a_{cb}}
Finally to work with non metric-compatible
spaces with nonmetricity the switch \comm{NONMETR}\swinda{NONMETR}
must be turned on. The nonmetricity 1-form is
\object{Nonmetricity N.a.b}{N_{ab}=N_{ab\mu}dx^\mu,
\quad N_{ab\mu}=-\nabla_\mu g_{ab}}
In general any torsion or nonmetricity related object is
defined iff the corresponding switch is on.

If either \comm{TORSION} or \comm{NONMETR} is on then Riemannian
versions of the connection 1-forms are available as well
\object{Riemann Frame Connection romega'a.b}
{\rim{\omega}{}^a{}_b}
\object{Riemann Holonomic Connection RGAMMA\^m\_n}
{\rim{\Gamma}{}^\mu{}_\nu}

The Riemann holonomic connection can be obtained
{\tt From Riemann frame connection}
\begin{equation}
\rim{\Gamma}{}^\mu{}_\nu=\rim{\omega}{}^\mu{}_\nu + dh^b_\nu\,h^\mu_b
\end{equation}



If torsion is nonzero but nonmetricity vanishes
(\comm{TORSION} is on, \comm{NONMETR} is off) then
the difference between the connection and Riemann connection
is called the contorsion 1-form
\object{Contorsion KQ'a.b}{\stackrel{\scriptscriptstyle Q}{K}\!{}^a{}_b=
\stackrel{\scriptscriptstyle Q}{K}\!{}^a{}_{b\mu}dx^\mu=
\Gamma^a{}_b-\rim{\Gamma}{}^a{}_b}

If nonmetricity is nonzero but torsion vanishes
(\comm{TORSION} is off, \comm{NONMETR} is on) then
the difference between the connection and Riemann connection
is called the nonmetricity defect
\object{Nonmetricity Defect KN'a.b}
{\stackrel{\scriptscriptstyle N}{K}\!{}^a{}_b=
\stackrel{\scriptscriptstyle N}{K}\!{}^a{}_{b\mu}dx^\mu=
\Gamma^a{}_b-\rim{\Gamma}{}^a{}_b}

Finally if both torsion and nonmetricity are nonzero
(\comm{TORSION} and \comm{NONMETR} are on) then we
\object{Connection Defect K'a.b}
{K^a{}_b=K^a{}_{b\mu}dx^\mu=
\Gamma^a{}_b-\rim{\Gamma}{}^a{}_b}
\begin{equation}
K^a{}_b = \stackrel{\scriptscriptstyle Q}{K}\!{}^a{}_b
+ \stackrel{\scriptscriptstyle N}{K}\!{}^a{}_b
\end{equation}


For the sake of convenience we introduce also macro objects
which compute the usual Christoffel symbols
\object{CHR\^m\_n\_p  }{ \{{}^\mu_{\nu\pi}\} =
\frac{1}{2}g^{\mu\tau}(\partial_\pi g_{\nu\tau}
+\partial_\nu g_{\pi\tau}
-\partial_\tau g_{\nu\pi})}
\object{CHRF\_m\_n\_p }{ [{}_{\mu},_{\nu\pi}]  =
\frac{1}{2}(\partial_\pi g_{\nu\mu}
+\partial_\nu g_{\pi\mu}
-\partial_\mu g_{\nu\pi})}
\object{CHRT\_m }{ \{{}^\pi_{\pi\mu}\} =
\frac{1}{2{\rm det}|g_{\alpha\beta}|}\partial_\mu\left(
{\rm det}|g_{\alpha\beta}|\right)}

The connection, frame, metric, torsion and nonmetricity are
related to each other by the so called structural equations
which in the most general case read
\begin{eqnarray}
&& D\theta^a + \Theta^a = 0 \nonumber\\[2mm]
&& Dg_{ab} + N_{ab} = 0 \label{str0}
\end{eqnarray}
or in the equivalent ``explicit'' form
\begin{equation}
\begin{array}{ll}
\omega^a{}_b\wedge\theta^b = -t^a,\qquad & t^a=d\theta^a+\Theta^a,\\[2mm]
\omega_{ab}+\omega_{ba} = n_{ab},\qquad & n_{ab}=dg_{ab}+N_{ab} \label{str}
\end{array}
\end{equation}

The solution to equations (\ref{str}) are given by the relation
\begin{equation}
\omega^a{}_b =
\frac{1}{2}\left[ -\partial^a\ipr t_b + \partial_b\ipr t^a + n^a{}_b
+\big(\partial^a\ipr(\partial_b\ipr t_c-n_{bc})
+\partial_b\ipr n^a{}_c\big)\theta^c\right] \label{solstr}
\end{equation}

For various specific values of $n_{ab}$ and $t^a$ equations
(\ref{str}) and (\ref{solstr}) can be used for different purposes.

In the most general case (\ref{solstr}) is the {\tt Standard way} to
compute connection 1-form $\omega^a{}_b$.
The torsion and nonmetricity are included in
these equations depending on the switches \comm{TORSION} and
\comm{NONMETR}.

The same equation (\ref{solstr}) with $n_{ab}=dg_{ab}$ and
$t^a=d\theta^a$ is the {\tt Standard way} to find Riemann
frame connection $\rim{\omega}{}^a{}_b$.

If torsion is nonzero then $\omega^a{}_b$ can be computed
{\tt From contorsion}
\begin{equation}
\omega^a{}_b = \rim{\omega}{}^a{}_b
+ \stackrel{\scriptscriptstyle Q}{K}\!{}^a{}_b  \label{a1}
\end{equation}
where $\rim{\omega}{}^a{}_b$ is given by Eq. (\ref{solstr}).

Similarly if nonmetricity is nonzero then $\omega^a{}_b$ can be computed
{\tt From nonmetricity defect}
\begin{equation}
\omega^a{}_b = \rim{\omega}{}^a{}_b
+ \stackrel{\scriptscriptstyle N}{K}\!{}^a{}_b   \label{a2}
\end{equation}
where $\rim{\omega}{}^a{}_b$ is given by Eq. (\ref{solstr}).

Finally if both torsion and nonmetricity are
nonzero then $\omega^a{}_b$ can be computed
{\tt From connection defect}
\begin{equation}
\omega^a{}_b = \rim{\omega}{}^a{}_b + K^a{}_b   \label{a3}
\end{equation}
where $\rim{\omega}{}^a{}_b$ is given by Eq. (\ref{solstr}).

The Riemannian part of connection in Eqs. (\ref{a1}),
(\ref{a2}), (\ref{a3}) are directly computed by Eq. (\ref{solstr})
(not via the object \comm{romega}).

The contorsion $\stackrel{\scriptscriptstyle Q}{K}\!{}^a{}_b$
is obtained {\tt From torsion} by (\ref{solstr})
with $t^a=\Theta^a$, $n_{ab}=0$.

The nonmetricity defect $\stackrel{\scriptscriptstyle N}{K}\!{}^a{}_b$
is obtained {\tt From nonmetricity} by (\ref{solstr})
with $t^a=0$, $n_{ab}=N_{ab}$.

Analogously (\ref{solstr}) with $t^a=\Theta^a$, $n_{ab}=N_{ab}$
is the {\tt Standard way} to compute the connection defect $K^a{}_b$.

The torsion $\Theta^a$ can be calculated {\tt From contorsion}
\begin{equation}
\Theta^a = -\stackrel{\scriptscriptstyle Q}{K}\!{}^a{}_b\wedge\theta^b
\end{equation}
or {\tt From connection defect}
\begin{equation}
\Theta^a = -K^a{}_b\wedge\theta^b
\end{equation}

The nonmetricity $N_{ab}$ can be computed {\tt From nonmetricity defect}
\begin{equation}
N_{ab} = \stackrel{\scriptscriptstyle N}{K}_{ab}+
\stackrel{\scriptscriptstyle N}{K}_{ba}
\end{equation}
or {\tt From connection defect}
\begin{equation}
N_{ab} = K_{ab}+K_{ba}
\end{equation}


\section{Spinorial Connection and Torsion}

Spinorial connection is defined in \grg\ iff nonmetricity
is zero and switch \comm{NONMETR} is turned off.
The upper sign in this section correspond to the signature
${\scriptstyle(-,+,+,+)}$ while lower one to the signature
${\scriptstyle(+,-,-,-)}$.

Spinorial connection is defined by the equation
\begin{equation}
DX^A_{\dot B} = dX^A{}_{\dot B}
\mp\omega^A{}_M\,X^M{}_{\dot B}
\pm\omega^{\dot M}{}_{\dot B}\,X^A{}_{\dot M}
\end{equation}
where due to antisymmetry of the frame connection
$\omega_{ab}=\omega_{[ab]}$ we have {\tt Spinorial connection}
1-forms
\begin{equation}
\omega_{ab} \tsst
\epsilon_{AB} \omega_{\dot A\dot B}
+ \epsilon_{\dot A\dot B} \omega_{AB}
\end{equation}
\object{Undotted Connection omegau.AB}{\omega_{AB}}
\object{Dotted Connection omegad.AB\cc}{\omega_{\dot A\dot B}}

The spinorial connection 1-forms
$\omega_{AB}$ and $\omega_{\dot A\dot B}$
can be calculated {\tt From frame connection} by the
standard spinor $\tsst$ tensor relation (\ref{asys}).

Inversely the frame connection $\omega_{ab}$ can be
found {\tt From spinorial connection} by relation (\ref{asyt}).

Since $\omega_{ab}$ is real the spinorial equivalents
$\omega_{AB}$ and $\omega_{\dot A\dot B}$ can be computed from
each other {\tt By conjugation}
\begin{equation}
\omega_{\dot A\dot B}=\overline{\omega_{AB}},\qquad
\omega_{AB}=\overline{\omega_{\dot A\dot B}}
\end{equation}

If torsion is nonzero (\comm{TORSION} is on) when we have
in addition the {\tt Riemann spinorial connection}
\object{Riemann Undotted Connection romegau.AB}{\rim{\omega}_{AB}}
\object{Riemann Dotted Connection romegad.AB\cc}{\rim{\omega}_{\dot A\dot B}}

The Riemann spinorial connection $\rim{\omega}_{AB}$
can be calculated by {\tt Standard way}
\begin{equation}
\stackrel{{\scriptscriptstyle\{\}}}{\omega}_{AB}= \label{ssolver}
\pm i*[ d  S_{AB}\wedge\theta_{C\dot C}
   -\epsilon_{C(A} d  S_{B)M}\wedge \theta^M_{\ \ \dot C}]\theta^{C\dot C}
\end{equation}
The conjugated relation is used for $\rim{\omega}_{\dot A\dot B}$.

The {\tt Spinorial contorsion} 1-forms
\object{Undotted Contorsion KU.AB}{\stackrel{\scriptscriptstyle Q}{K}\!{}_{AB}}
\object{Dotted Contorsion KD.AB\cc}{\stackrel{\scriptscriptstyle Q}{K}\!{}_{\dot A\dot B}}
are the spinorial analogues of the contorsion 1-form
\begin{equation}
\stackrel{\scriptscriptstyle Q}{K}_{ab} \tsst
\epsilon_{AB} \stackrel{\scriptscriptstyle Q}{K}_{\dot A\dot B}
+ \epsilon_{\dot A\dot B} \stackrel{\scriptscriptstyle Q}{K}_{AB}
\end{equation}

The spinorial contorsion 1-forms
$\stackrel{\scriptscriptstyle Q}{K}_{AB}$ and $\stackrel{\scriptscriptstyle Q}{K}_{\dot A\dot B}$
can be calculated {\tt From contorsion} by the
standard spinor $\tsst$ tensor relation (\ref{asys}).

Inversely the contorsion $\stackrel{\scriptscriptstyle Q}{K}_{ab}$ can be
found {\tt From spinorial contorsion} by relation (\ref{asyt}).

The spinorial equivalents
$\stackrel{\scriptscriptstyle Q}{K}_{AB}$ and $\stackrel{\scriptscriptstyle Q}{K}_{\dot A\dot B}$
can be computed from
each other {\tt By conjugation}
\begin{equation}
\stackrel{\scriptscriptstyle Q}{K}_{\dot A\dot B}=\overline{\stackrel{\scriptscriptstyle Q}{K}_{AB}},\qquad
\stackrel{\scriptscriptstyle Q}{K}_{AB}=\overline{\stackrel{\scriptscriptstyle Q}{K}_{\dot A\dot B}}
\end{equation}

The {\tt Standard way} to find $\omega_{AB}$ is
\begin{equation}
\omega_{AB} = \rim{\omega}_{AB}+\stackrel{\scriptscriptstyle Q}{K}_{AB}
\end{equation}
where $\rim{\omega}_{AB}$ is given directly by Eq. (\ref{ssolver}).
The conjugated Eq. is used for $\omega_{\dot A\dot B}$.


\section{Curvature}

The curvature 2-form
\object{Curvature OMEGA'a.b}{\Omega^a{}_b=
\frac{1}{2}R^a_{bcd}\,S^{cd}}
can be computed {\tt By standard way}
\begin{equation}
\Omega^a{}_b = d\omega^a{}_b + \omega^a{}_n \wedge \omega^n{}_b \label{omes}
\end{equation}

The Riemann curvature tensor is given by the relation
\object{Riemann Tensor  RIM'a.b.c.d}{R^a{}_{bcd}=
\partial_d\ipr\partial_c\ipr\Omega^a{}_b}

The Ricci tensor
\object{Ricci Tensor RIC.a.b}{R_{ab}}
can be computed {\tt From Curvature}
\begin{equation}
R_{ab} = \partial_b\ipr\partial_m\ipr\Omega^m{}_a \label{rics}
\end{equation}
or {\tt From Riemann tensor}
\begin{equation}
R_{ab} = R^m{}_{amb}
\end{equation}

The
\object{Scalar Curvature RR}{R}
can be computed {\tt From Ricci Tensor}
\begin{equation}
R = R_{mn}\,g^{mn}
\end{equation}

The Einstein tensor is given by the relation
\object{Einstein Tensor GT.a.b}{G_{ab}=R_{ab}-\frac{1}{2}g_{ab}R}

If nonmetricity is nonzero (\comm{NONMETR} is on) then we have
\object{Homothetic Curvature  OMEGAH}{\OO{h}}
\object{A-Ricci Tensor RICA.a.b}{\RR{A}_{ab}}
\object{S-Ricci Tensor RICS.a.b}{\RR{S}_{ab}}

They can be calculated {\tt From curvature} by the
relations
\begin{equation}
\OO{h}=\Omega^n{}_n
\end{equation}
\begin{equation}
\RR{A}_{ab}= \partial_b\ipr\partial^m\ipr\Omega_{[ma]}
\end{equation}
\begin{equation}
\RR{S}_{ab}= \partial_b\ipr\partial^m\ipr\Omega_{(ma)}
\end{equation}
and the scalar curvature can be computed {\tt From A-Ricci tensor}
\begin{equation}
R = \RR{A}_{mn}g^{mn}
\end{equation}


\section{Spinorial Curvature}

Spinorial curvature is defined in \grg\ iff nonmetricity
is zero and switch \comm{NONMETR} is turned off.
The upper sign in this section correspond to the signature
${\scriptstyle(-,+,+,+)}$ while lower one to the signature
${\scriptstyle(+,-,-,-)}$.

The {\tt Spinorial curvature} 2-forms
\object{Undotted Curvature OMEGAU.AB}{\Omega_{AB}}
\object{Dotted Curvature OMEGAD.AB\cc}{\Omega_{\dot A\dot B}}
is related to the curvature 2-form $\Omega_{ab}$ by the standard
relation
\begin{equation}
\Omega_{ab} \tsst
\epsilon_{AB} \Omega_{\dot A\dot B}
+ \epsilon_{\dot A\dot B} \Omega_{AB}
\end{equation}

The spinorial curvature 1-forms
$\Omega_{AB}$ and $\Omega_{\dot A\dot B}$
can be calculated {\tt From curvature} by the
relation (\ref{asys}).

The frame curvature $\Omega_{ab}$ can be
found {\tt From spinorial curvature} by relation (\ref{asyt}).

The $\Omega_{AB}$ and $\Omega_{\dot A\dot B}$ can be
computed from each other {\tt By conjugation}
\begin{equation}
\Omega_{\dot A\dot B}=\overline{\Omega_{AB}},\qquad
\Omega_{AB}=\overline{\Omega_{\dot A\dot B}}
\end{equation}

The {\tt Standard way} to calculate $\Omega_{AB}$ is
\begin{equation}
\Omega_{AB} = d\omega_{AB} \pm \omega_A{}^M\wedge\omega_{MB}
\end{equation}
The conjugated relation is used for $\Omega_{\dot A\dot B}$.


\section{Curvature Decomposition}

In general curvature consists of 11 irreducible pieces.
If nonmetricity is nonzero then one can
perform decomposition
\begin{equation}
R_{abcd}=\RR{A}_{abcd}+\RR{S}_{abcd},\qquad
\RR{A}_{abcd}=R_{[ab]cd},\qquad
\RR{S}_{abcd}=R_{(ab)cd}
\end{equation}
Here the S-part of the curvature vanishes identically if
nonmetricity is zero and we consider further decomposition
of A and S parts independently.

First we consider the A-part of the curvature. It can be
decomposed into 6 pieces
\begin{equation}
\RR{A}_{abcd} =
\RR{w}_{abcd}+
\RR{c}_{abcd}+
\RR{r}_{abcd}+
\RR{a}_{abcd}+
\RR{b}_{abcd}+
\RR{d}_{abcd}
\end{equation}
Here first three terms are the well-known irreducible pieces
of the Riemannian curvature while last three terms vanish if
torsion is zero. The corresponding 2-forms are
\object{Weyl 2-form                        OMW.a.b }
{\OO{w}_{ab} = \frac12 \RR{w}_{abcd}\,S^{cd}}
\object{Traceless Ricci 2-form             OMC.a.b }
{\OO{c}_{ab} = \frac12 \RR{c}_{abcd}\,S^{cd}}
\object{Scalar Curvature 2-form            OMR.a.b }
{\OO{r}_{ab} = \frac12 \RR{r}_{abcd}\,S^{cd}}
\object{Ricanti 2-form                     OMA.a.b }
{\OO{a}_{ab} = \frac12 \RR{a}_{abcd}\,S^{cd}}
\object{Traceless Deviation 2-form         OMB.a.b }
{\OO{b}_{ab} = \frac12 \RR{b}_{abcd}\,S^{cd}}
\object{Antisymmetric Curvature 2-form     OMD.a.b }
{\OO{d}_{ab} = \frac12 \RR{d}_{abcd}\,S^{cd}}

The {\tt Standard way} to find these quantities is given
by the following formulas.
\begin{equation}
\OO{r}_{ab} = \frac{1}{d(d-1)}R\,S_{ab}
\end{equation}
\begin{equation}
\OO{c}_{ab} = \frac{1}{(d-2)}\left[
C_{am}\,\theta^m\!\wedge\theta_b
-C_{bm}\,\theta^m\!\wedge\theta_a\right],\quad
C_{ab}=\RR{A}_{(ab)}-\frac{1}{d}g_{ab}R
\end{equation}
\begin{equation}
\OO{a}_{ab} = \frac{1}{(d-2)}\left[
A_{am}\,\theta^m\!\wedge\theta_b
-A_{bm}\,\theta^m\!\wedge\theta_a\right],\quad
A_{ab}=\RR{A}_{[ab]}
\end{equation}
\begin{equation}
\OO{d}_{ab} = \frac{1}{12}\partial_b\ipr\partial_a\ipr
(\OO{A}_{mn}\wedge\theta^m\!\wedge\theta^n)
\end{equation}
\begin{equation}
\OO{b}_{ab} =\frac{1}{2}\left[
\partial_b\ipr(\theta^m\!\wedge\OO{A0}_{am})
-\partial_a\ipr(\theta^m\!\wedge\OO{A0}_{bm})
\right]
\end{equation}
where
\[
\OO{A0}_{ab} =
\OO{A}_{ab}
-\OO{c}_{ab}
-\OO{r}_{ab}
-\OO{a}_{ab}
-\OO{d}_{ab}
\]
And finally
\begin{equation}
\OO{w}_{ab} =
\OO{A}_{ab}
-\OO{c}_{ab}
-\OO{r}_{ab}
-\OO{a}_{ab}
-\OO{b}_{ab}
-\OO{d}_{ab}
\end{equation}

If $d=2$ then $\OO{A}_{ab}$ turns out to be irreducible and
coincides with the scalar curvature irreducible piece
\begin{equation}
\OO{A}_{ab} = \OO{r}_{ab}
\end{equation}

Now we consider the decomposition of the S curvature part which
is nonzero iff nonmetricity is nonzero. First we consider
the case $d\geq3$. In this case we have 5 irreducible components
\begin{equation}
\RR{S}_{abcd} =
\RR{h}_{abcd}+
\RR{sc}_{abcd}+
\RR{sa}_{abcd}+
\RR{v}_{abcd}+
\RR{u}_{abcd}
\end{equation}

The corresponding 2-forms are
\object{Homothetic Curvature 2-form        OSH.a.b }
{\OO{h}_{ab} = \frac12 \RR{h}_{abcd}\,S^{cd}}
\object{Antisymmetric S-Ricci 2-form      OSA.a.b  }
{\OO{sa}_{ab} = \frac12 \RR{sa}_{abcd}\,S^{cd}}
\object{Traceless S-Ricci 2-form          OSC.a.b  }
{\OO{sc}_{ab} = \frac12 \RR{sc}_{abcd}\,S^{cd}}
\object{Antisymmetric S-Curvature 2-form  OSV.a.b  }
{\OO{v}_{ab} = \frac12 \RR{v}_{abcd}\,S^{cd}}
\object{Symmetric S-Curvature 2-form      OSU.a.b  }
{\OO{u}_{ab} = \frac12 \RR{u}_{abcd}\,S^{cd}}


The {\tt Standard way} to compute the decomposition is
\begin{equation}
\OO{h}_{ab}=-\frac{1}{(d^2-4)}\left[
\theta_a\wedge\partial_b\ipr\OO{h}{}
+\theta_b\wedge\partial_a\ipr\OO{h}{}
-g_{ab}\OO{h}{}d\right]
\end{equation}
\begin{equation}
\OO{sa}_{ab} =\frac{d}{(d^2-4)}\left[
\theta_a\wedge(\RR{S}_{[bm]}\wedge\theta^m)
+\theta_b\wedge(\RR{S}_{[am]}\wedge\theta^m)
-\frac{2}{d}g_{ab}\,\RR{S}_{cd}S^{cd}\right]
\end{equation}
\begin{equation}
\OO{sc}_{ab} =\frac{1}{d}\left[
\theta_a\wedge(\RR{S}_{(bm)}\wedge\theta^m)
+\theta_b\wedge(\RR{S}_{(am)}\wedge\theta^m)\right] \label{ccc}
\end{equation}
\begin{equation}
\OO{v}_{ab} = \frac{1}{4}\left[
\partial_a\ipr(\OO{S0}_{bm}\wedge\theta^m)
+\partial_b\ipr(\OO{S0}_{am}\wedge\theta^m)\right]
\end{equation}
where
\[
\OO{S0}_{ab} =
\OO{S}_{ab}
-\OO{h}_{ab}
-\OO{sa}_{ab}
-\OO{sc}_{ab}
\]
And finally
\begin{equation}
\OO{u}_{ab} =
\OO{S}_{ab}
-\OO{h}_{ab}
-\OO{sa}_{ab}
-\OO{sc}_{ab}
-\OO{v}_{ab}
\end{equation}

If $d=2$ then only the h- and sc-components are nonzero.
The $\OO{sc}_{ab}$ are given by (\ref{ccc}) and
\begin{equation}
\OO{h}_{ab} = \OO{S}_{ab}-\OO{sc}_{ab}
\end{equation}

\begin{center}
\begin{tabular}{|c|c|c|}
\hline object & exists if & and has $n$ components \\
\hline
\vv$R_{abcd}$ &     & $\frac{d^3(d-1)}{2}$ \\[1mm]
\hline\vv$\rim{R}{}_{abcd}$  &        & $\frac{d^2(d^2-1)}{12}$ \\[1mm]
\hline\vv$\RR{A}_{abcd}$  &        & $\frac{d^2(d-1)^2}{4}$ \\[1mm]
\hline\vv$\RR{S}_{abcd}$  &        & $\frac{d^2(d^2-1)}{4}$ \\[1mm]
\hline\vv$\RR{w}_{abcd}$  & $d\geq4$ & $\frac{d(d+1)(d+2)(d-3)}{12}$ \\
\vv$\RR{c}_{abcd}$  & $d\geq3$ & $\frac{(d+2)(d-1)}{2}$ \\
\vv$\RR{r}_{abcd}$  &          & $1$ \\[1mm]
\hline\vv$\RR{a}_{abcd}$  & $d\geq3$ & $\frac{d(d-1)}{2}$ \\
\vv$\RR{b}_{abcd}$  & $d\geq4$ & $\frac{d(d-1)(d+2)(d-3)}{8}$ \\
\vv$\RR{d}_{abcd}$  & $d\geq4$ & $\frac{d(d-1)(d-2)(d-3)}{24}$ \\[1mm]
\hline\vv$\RR{h}_{abcd}$  &          & $\frac{d(d-1)}{2}$ \\
\vv$\RR{sa}_{abcd}$ & $d\geq3$ & $\frac{d(d-1)}{2}$ \\
\vv$\RR{sc}_{abcd}$ &          & $\frac{(d+2)(d-1)}{2}$ \\
\vv$\RR{v}_{abcd}$  & $d\geq4$ & $\frac{d(d+2)(d-1)(d-3)}{8}$ \\
\vv$\RR{u}_{abcd}$  & $d\geq3$ & $\frac{(d-2)(d+4)(d^2-1)}{8}$ \\[1mm]
\hline
\end{tabular}
\end{center}



\section{Spinorial Curvature Decomposition}

Spinorial curvature is defined in \grg\ iff nonmetricity
is zero and switch \comm{NONMETR} is turned off.
The upper sign in this section correspond to the signature
${\scriptstyle(-,+,+,+)}$ while lower one to the signature
${\scriptstyle(+,-,-,-)}$.

Let us introduce the spinorial analog of the curvature tensor
\begin{eqnarray}
R_{abcd}&\tsst&
\ \ R_{ABCD}\epsilon_{\dot{A}\dot{B}}\epsilon_{\dot{C}\dot{D}}
+R_{\dot{A}\dot{B}\dot{C}\dot{D}}\epsilon_{AB}\epsilon_{CD} \nonumber\\[1mm]
&&+R_{AB\dot{C}\dot{D}}\epsilon_{\dot{A}\dot{B}}\epsilon_{CD}
+R_{\dot{A}\dot{B} CD}\epsilon_{AB}\epsilon_{\dot{C}\dot{D}},  \\[1.5mm]
R_{ABCD}&=&-i*(\Omega_{AB}\wedge S_{CD}),\ \
R_{AB\dot{C}\dot{D}}\ =\ i*(\Omega_{AB}\wedge S_{\dot{C}\dot{D}})\\[1.5mm]
R_{\dot{A}\dot{B}\dot{C}\dot{D}}&=&\overline{R_{ABCD}},\ \
R_{\dot{A}\dot{B} CD}\ =\ \overline{R_{AB\dot{C}\dot{D}}}
\end{eqnarray}

The quantities $R_{ABCD}$ and $R_{AB\dot C\dot D}$ can be used to compute
the {\tt Curvature spinors} ($\equiv$ {\tt Curvature components})
\object{Weyl Spinor                 RW.ABCD}{C_{ABCD}}
\object{Traceless Ricci Spinor      RC.AB.CD\cc}{C_{AB\dot C\dot D}}
\object{Scalar Curvature                      RR}{R}
\object{Ricanti Spinor              RA.AB}{A_{AB}}
\object{Traceless Deviation Spinor  RB.AB.CD\cc}{B_{AB\dot C\dot D}}
\object{Scalar Deviation            RD}{D}
All these spinors are irreducible (totally symmetric).

Weyl spinor $C_{ABCD}$ {\tt From spinor curvature} is
\begin{eqnarray}
C_{abcd}&\tsst& C_{ABCD}\epsilon_{\dot{A}\dot{B}}\epsilon_{\dot{C}\dot{D}}
             +C_{\dot{A}\dot{B}\dot{C}\dot{D}}\epsilon_{AB}\epsilon_{CD} \\[1mm]
C_{ABCD}&=&R_{(ABCD)} \label{RW}
\end{eqnarray}

Traceless Ricci spinor $C_{AB\dot{A}\dot{B}}$ {\tt From spinor curvature} is
\begin{eqnarray}
C_{ab}&\tsst&C_{AB\dot{A}\dot{B}}\\[2mm]
C_{AB\dot{C}\dot{D}}&=&\pm(R_{AB\dot{C}\dot{D}}+R_{\dot{C}\dot{D} AB})
\end{eqnarray}

Scalar curvature {\tt From spinor curvature} is
\begin{equation} R=2(R^{MN}_{\ \ \ \ MN}+R^{\dot{M}\dot{N}}_{\ \ \ \ \dot{M}\dot{N}})
\end{equation}

Antisymmetric Ricci spinor $A_{AB}$ {\tt From spinor curvature} is
\begin{eqnarray}
A_{ab}&\tsst& A_{AB}\epsilon_{\dot{A}\dot{B}}+A_{\dot{A}\dot{B}}\epsilon_{AB}\\[1mm]
A_{AB}&=&\mp R^{\ \ \ \,M}_{(A|\ \ M|B)}
\end{eqnarray}

Traceless deviation spinor $B_{AB\dot{A}\dot{B}}$ {\tt From spinor curvature} is
\begin{eqnarray}
B_{ab}&\tsst&B_{AB\dot{A}\dot{B}}\\[1mm]
B_{AB\dot{C}\dot{D}}&=&\pm i(R_{AB\dot{C}\dot{D}}-R_{\dot{C}\dot{D} AB})
\end{eqnarray}

Deviation trace {\tt From spinor curvature} is
\begin{equation}
D=-2i(R^{MN}_{\ \ \ \  MN}-R^{\dot{M}\dot{N}}_{\ \ \ \ \dot{M}\dot{N}})
\end{equation}

Note that spinors $C_{AB\dot{A}\dot{B}},B_{AB\dot{A}\dot{B}}$ are Hermitian
\begin{equation}
C_{AB\dot{C}\dot{D}}=\overline{C_{CD\dot{A}\dot{B}}},\ \
B_{AB\dot{C}\dot{D}}=\overline{B_{CD\dot{A}\dot{B}}}
\end{equation}

Finally we introduce the decomposition for the spinorial
curvature 2-form
\begin{equation}
\Omega_{AB}=
\OO{w}_{AB}+\OO{c}_{AB}+\OO{r}_{AB}
+\OO{a}_{AB}+\OO{b}_{AB}+\OO{c}_{AB}
\end{equation}
where the {\tt Undotted curvature 2-forms}
\object{Undotted Weyl 2-form                 OMWU.AB }{\OO{w}_{AB}}
\object{Undotted Traceless Ricci 2-form      OMCU.AB }{\OO{c}_{AB}}
\object{Undotted Scalar Curvature 2-form     OMRU.AB }{\OO{r}_{AB}}
\object{Undotted Ricanti 2-form              OMAU.AB }{\OO{a}_{AB}}
\object{Undotted Traceless Deviation 2-form  OMBU.AB }{\OO{b}_{AB}}
\object{Undotted Scalar Deviation 2-form     OMDU.AB }{\OO{d}_{AB}}
are given by
\begin{eqnarray}
\OO{w}_{AB}&=&C_{ABCD}S^{CD}  \\[1mm]
\OO{c}_{AB}&=&\pm\frac12 C_{AB\dot{C}\dot{D}}S^{\dot{C}\dot{D}} \\[1mm]
\OO{r}_{AB}&=&\frac1{12}S_{AB}R \\[1mm]
\OO{a}_{AB}&=&\pm A_{(A}^{\ \ \ M}S_{M|B)} \\[1mm]
\OO{b}_{AB}&=&\mp\frac{i}2 B_{AB\dot{C}\dot{D}}S^{\dot{C}\dot{D}} \\[1mm]
\OO{d}_{AB}&=&\frac{i}{12}S_{AB}D
\end{eqnarray}







\section{Torsion Decomposition}

The torsion tensor
\begin{equation}
Q_{abc}=Q_{a[bc]},\qquad
\Theta^a=\frac{1}{2}Q^a{}_{bc}\,S^{bc}
\end{equation}
consists of three irreducible pieces
\begin{equation}
Q_{abc} =
\stackrel{\rm c}{Q}_{abc}
+\stackrel{\rm t}{Q}_{abc}
+\stackrel{\rm a}{Q}_{abc}
\end{equation}

\begin{center}
\begin{tabular}{|c|c|c|}
\hline object & exists if & and has $n$ components \\
\hline
\vv$Q_{abc}$ &  & $\frac{d^2(d-1)}{2}$ \\[1mm]
\hline\vv$\stackrel{\rm c}{Q}_{abc}$ & $d\geq3$ & $\frac{d(d^2-4)}{3}$ \\
\vv$\stackrel{\rm t}{Q}_{abc}$ &          & $d$ \\
\vv$\stackrel{\rm a}{Q}_{abc}$ & $d\geq3$ & $\frac{d(d-1)(d-2)}{6}$ \\[1mm]
\hline
\end{tabular}
\end{center}

The corresponding union of three objects {\tt Torsion 2-forms} is
\object{Traceless Torsion 2-form       THQC'a}
{\stackrel{\rm c}{\Theta}\!{}^a=\frac{1}{2}
 \stackrel{\rm c}{Q}\!{}^a{}_{bc}\,S^{bc}}
\object{Torsion Trace 2-form           THQT'a}
{\stackrel{\rm t}{\Theta}\!{}^a=\frac{1}{2}
 \stackrel{\rm t}{Q}\!{}^a{}_{bc}\,S^{bc}}
\object{Antisymmetric Torsion 2-form   THQA'a}
{\stackrel{\rm a}{\Theta}\!{}^a=\frac{1}{2}
 \stackrel{\rm a}{Q}\!{}^a{}_{bc}\,S^{bc}}

And the auxiliary quantities
\object{Torsion Trace  QT'a}{Q^a}
\object{Torsion Trace 1-form  QQ}{Q=-\partial_a\ipr\Theta^a}
\object{Antisymmetric Torsion 3-form QQA}{\stackrel{\rm a}{Q}=\theta_a\wedge\Theta^a}

The torsion trace $Q^a=Q^m{}_{am}$ can be obtained {\tt From torsion
trace 1-form}
\begin{equation}
Q^a = \partial^a\ipr Q
\end{equation}

The {\tt Standard way} for the irreducible torsion 2-forms is
\begin{equation}
\stackrel{\rm t}{\Theta}\!{}^a = -\frac{1}{(d-1)}\theta^a\wedge Q
\end{equation}
\begin{equation}
\stackrel{\rm t}{\Theta}\!{}^a = \frac{1}{3}\partial^a\ipr\stackrel{\rm a}{Q}
\end{equation}
\begin{equation}
\stackrel{\rm c}{\Theta}\!{}^a = \Theta^a
-\stackrel{\rm t}{\Theta}\!{}^a
-\stackrel{\rm a}{\Theta}\!{}^a
\end{equation}

The rest of this section is valid in dimension 4 only.

In this case one can introduce the torsion pseudo trace
\object{Torsion Pseudo Trace QP'a}{
P^a = \stackrel{*}{Q}\!{}^{ma}{}_{m},
\ \stackrel{*}{Q}\!{}^a{}_{bc} = \frac{1}{2}{\cal E}_{bc}{}^{pq}
Q^a{}_{pq}}
which can be computed {\tt From antisymmetric torsion 3-form}
\begin{equation}
P^a = \partial^a\ipr\,*\!\stackrel{\rm a}{Q}
\end{equation}

Finally let us consider the spinorial representation of the
torsion.
Below the upper sign corresponds to the
\seethis{See \pref{spinors}\ or \ref{spinors1}.}
signature ${\scriptstyle(-,+,+,+)}$ and lower one to the
signature ${\scriptstyle(+,-,-,-)}$.

First we introduce the spinorial analog of the torsion tensor
\begin{equation}
Q_{abc}\tsst Q_{A\dot{A} BC}\epsilon_{\dot{B}\dot{C}}
+Q_{A\dot{A}\dot{B}\dot{C}}\epsilon_{BC}
\end{equation}
where
\begin{equation}
Q_{A\dot{A} BC}=-i*(\Theta_{A\dot{A}}\wedge S_{BC}),\qquad
Q_{A\dot{A}\dot{B}\dot{C}}=i*(\Theta_{A\dot{A}}\wedge S_{\dot{B}\dot{C}})
\end{equation}
These spinors are reducible but the
\object{Traceless Torsion Spinor  QC.ABC.D\cc}{C_{ABC\dot D}}
\[
\stackrel{\rm c}{Q}_{abc}\tsst C_{ABC\dot A}\epsilon_{\dot{B}\dot{C}}
+Q_{\dot{A}\dot{B}\dot{C}A}\epsilon_{BC},\quad
C_{\dot{A}\dot{B}\dot{C} A}=\overline{C_{ABC\dot{A}}}
\]
is irreducible (symmetric in $\scriptstyle ABC$). And it can be
computed {\tt From torsion} by the relation
\begin{equation}
C_{ABC\dot A} = Q_{(A|\dot{A}|BC)}
\end{equation}

The torsion trace can be calculated {\tt From torsion using spinors}
\begin{equation}
Q^a\tsst Q^{A\dot{A}},\quad
Q_{A\dot{B}}=\mp(Q^M{}_{\dot{B}MA}+Q_A{}^{\dot M}{}_{\dot M\dot{B}})
\end{equation}

And similarly the torsion pseudo-trace can be found
{\tt From torsion using spinors}
\begin{equation}
P^a\tsst P^{A\dot{A}},\quad
P_{A\dot{B}}=\mp i(Q^M{}_{\dot{B}MA}-Q_A{}^{\dot M}{}_{\dot M\dot{B}})
\end{equation}

Finally we introduce the {\tt Undotted trace 2-forms}
which are selfdual parts of the irreducible torsion 2-forms
\object{Undotted Traceless Torsion 2-form       THQCU'a}
{\stackrel{\rm c}{\vartheta}\!{}^a}
\object{Undotted Torsion Trace 2-form           THQTU'a}
{\stackrel{\rm t}{\vartheta}\!{}^a}
\object{Undotted Antisymmetric Torsion 2-form   THQAU'a}
{\stackrel{\rm a}{\vartheta}\!{}^a} \seethis{See \pref{thetau}.}
These quantities will be used in the gravitational equations.

This complex 2-forms can be obtained by the equations
({\tt Standard way}):
\begin{eqnarray}
\stackrel{\rm c}{\vartheta}\!{}^a &\tsst& \stackrel{\rm c}{\vartheta}\!{}^{A\dot A}
=C^A_{\ \ BC}{}^{\dot{A}}S^{BC}\\[1mm]
\stackrel{\rm t}{\vartheta}\!{}^a &\tsst& \stackrel{\rm t}{\vartheta}\!{}^{A\dot A}
=\mp\frac13 Q_{M}^{\ \ \ \dot{A}}S^{AM}\\[1mm]
\stackrel{\rm a}{\vartheta}\!{}^a &\tsst& \stackrel{\rm a}{\vartheta}\!{}^{A\dot A}
=\pm\frac{i}3 P_{M}^{\ \ \ \dot{A}}S^{AM}
\end{eqnarray}



\section{Nonmetricity Decomposition}

In general the nonmetricity tensor
\begin{equation}
N_{abc}=N_{(ab)c},\qquad N_{ab}=N_{abc}\theta^c
\end{equation}
consist of 4 irreducible pieces
\begin{equation}
N_{abcd} =
\stackrel{\rm c}{N}_{abc}
+\stackrel{\rm a}{N}_{abc}
+\stackrel{\rm t}{N}_{abc}
+\stackrel{\rm w}{N}_{abc}
\end{equation}

\begin{center}
\begin{tabular}{|c|c|c|}
\hline object & exists if & and has $n$ components \\
\hline
\vv$N_{abc}$ &  & $\frac{d^2(d+1)}{2}$ \\[1mm]
\hline\vv$\stackrel{\rm c}{N}_{abc}$ &  & $\frac{d(d-1)(d+4)}{6}$ \\
\vv$\stackrel{\rm a}{N}_{abc}$ & $d\geq3$ & $\frac{d(d^2-4)}{3}$ \\
\vv$\stackrel{\rm t}{N}_{abc}$ &  & $d$ \\
\vv$\stackrel{\rm w}{N}_{abc}$ &  & $d$ \\[1mm]
\hline
\end{tabular}
\end{center}

The corresponding union of objects {\tt Nonmetricity 1-forms}
consist of
\object{Symmetric Nonmetricity 1-form      NC.a.b}
{\stackrel{\rm c}{N}_{ab}=\stackrel{\rm c}{N}_{abc}\theta^c}
\object{Antisymmetric Nonmetricity 1-form  NA.a.b}
{\stackrel{\rm a}{N}_{ab}=\stackrel{\rm a}{N}_{abc}\theta^c}
\object{Nonmetricity Trace  1-form         NT.a.b}
{\stackrel{\rm t}{N}_{ab}=\stackrel{\rm t}{N}_{abc}\theta^c}
\object{Weyl Nonmetricity 1-form           NW.a.b}
{\stackrel{\rm w}{N}_{ab}=\stackrel{\rm w}{N}_{abc}\theta^c}

We have also two auxiliary 1-forms
\object{Weyl Vector           NNW}{\stackrel{\rm w}{N}}
\object{Nonmetricity Trace    NNT}{\stackrel{\rm t}{N}}

They are computed according to the following formulas
\begin{equation}
\stackrel{\rm w}{N} = N^a{}_a
\end{equation}
\begin{equation}
\stackrel{\rm t}{N} = \theta^a\,\partial^b\ipr N_{ab}
- \frac{1}{d} \stackrel{\rm w}{N}
\end{equation}
\begin{equation}
\stackrel{\rm w}{N}_{ab} = \frac{1}{d}g_{ab}\stackrel{\rm w}{N}
\end{equation}
\begin{equation}
\stackrel{\rm t}{N}_{ab}=\frac{d}{(d-1)(d+2)}\left[
\theta_b\partial_a\ipr\stackrel{\rm t}{N}
+\theta_a\partial_b\ipr\stackrel{\rm t}{N}
-\frac{2}{d} g_{ab} \stackrel{\rm t}{N}\right]
\end{equation}
\begin{equation}
\stackrel{\rm a}{N}_{ab}=\frac{1}{3}\left[
\partial_a\ipr(\theta^m\wedge\stackrel{0}{N}_{bm})
+\partial_b\ipr(\theta^m\wedge\stackrel{0}{N}_{am})\right]
\end{equation}
where
\[
\stackrel{\rm 0}{N}_{ab}=
N_{abc}
-\stackrel{\rm t}{N}_{abc}
-\stackrel{\rm w}{N}_{abc}
\]
And finally
\begin{equation}
\stackrel{\rm c}{N}_{ab}=
N_{abc}
-\stackrel{\rm a}{N}_{abc}
-\stackrel{\rm t}{N}_{abc}
-\stackrel{\rm w}{N}_{abc}
\end{equation}

\section{Newman-Penrose Formalism}

The method of spinorial differential forms described in the
previous sections are essentially equivalent to the well
known Newman-Penrose formalism but for the sake of convenience
\grg\ has complete set of macro objects which allows to
write the Newman-Penrose equations in
traditional notation. All these objects refer (up to some sign
and 1/2 factors) to other \grg\ built-in objects.

In this section upper sign corresponds to the
signature ${\scriptstyle(-,+,+,+)}$ and lower one to the
signature ${\scriptstyle(+,-,-,-)}$.
\seethis{See \pref{spinors}.}
The frame must be null as explained in section \ref{spinors}.

For the Newman-Penrose formalism we use notation and conventions
of the book \emph{Exact Solutions of the Einstein Field Equations}
by D. Kramer, H. Stephani, M. MacCallum and E. Herlt, ed.
E. Schmutzer (Berlin, 1980). We denote this book as ESEFE.

We chose the relationships between NP null tetrad and \grg\ null
frame as follows
\begin{equation}
l^\mu=h^\mu_0,\quad
k^\mu=h^\mu_1,\quad
\overline{m}\!{}^\mu=h^\mu_2,\quad
m^\mu=h^\mu_3
\end{equation}

The NP vector operators are just the components of the
vector frame $\partial_a$
\begin{eqnarray}
\mbox{\tt DD}&=& D =\partial_1 \\
\mbox{\tt DT}&=& \Delta=\partial_0 \\
\mbox{\tt du}&=& \delta=\partial_3 \\
\mbox{\tt dd}&=& \overline\delta=\partial_2
\end{eqnarray}

The spin coefficient are the components of the connection
1-form
\object{SPCOEF.AB.c}{ \omega_{AB\,c}=\partial_c\ipr\omega_{AB}}
or in the NP notation
\begin{eqnarray}
\mbox{\tt alphanp      }&=& \alpha =\pm\omega_{(1)2} \\
\mbox{\tt betanp       }&=& \beta =\pm\omega_{(1)3} \\
\mbox{\tt gammanp      }&=& \gamma =\pm\omega_{(1)0} \\
\mbox{\tt epsilonnp    }&=& \epsilon =\pm\omega_{(1)1} \\
\mbox{\tt kappanp      }&=& \kappa =\pm\omega_{(0)1} \\
\mbox{\tt rhonp        }&=& \rho =\pm\omega_{(0)2} \\
\mbox{\tt sigmanp      }&=& \sigma =\pm\omega_{(0)3} \\
\mbox{\tt taunp        }&=& \tau =\pm\omega_{(0)0} \\
\mbox{\tt munp         }&=& \mu =\pm\omega_{(2)3} \\
\mbox{\tt nunp         }&=& \nu =\pm\omega_{(2)0} \\
\mbox{\tt lambdanp     }&=& \lambda =\pm\omega_{(2)2} \\
\mbox{\tt pinp         }&=& \pi =\pm\omega_{(2)1} \\
\end{eqnarray}
where the first index of the
quantity $\omega_{(AB)c}$ is included inn parentheses to remind
that it is summed spinorial index.

Finally for the curvature we have
\object{PHINP.AB.CD\cc }{
\Phi_{AB\dot{C}\dot{D}} = \pm\frac{1}{2}C_{AB\dot C\dot D} }
\object{PSINP.ABCD }{\Psi_{ABCD}=C_{ABCD}}
the conventions for the scalar curvature $R$ in ESEFE and
in \grg\ are the same.

For the signature ${\scriptstyle(-,+,+,+)}$ the Newman-Penrose equations for
the quantities introduced above can be found in section 7.1 of ESEFE.
For other signature ${\scriptstyle(+,-,-,-)}$ one must alter the sign of
$\Psi_{ABCD}$, $\Phi_{AB\dot{C}\dot{D}}$ and $R$ in Eqs. (7.28)--(7.45).

\section{Electromagnetic Field}

Formulas in this section are valid only in spaces
with the signature ${\scriptstyle(-,+,\dots,+)}$ and
${\scriptstyle(+,-,\dots,-)}$.
The sign factor $\sigma$ in the expressions below is
$\sigma=-{\rm diag}_0$ ($+1$ for the first signature and $-1$
for the second).

Let us introduce the
\object{EM Potential A}{A=A_\mu dx^\mu}
and the
\object{Current 1-form     J}{J=j_\mu dx^\mu}

The EM strength tensor
$F_{\alpha\beta}=\partial_\alpha A_\beta-\partial_\beta A_\alpha$
\object{EM Tensor  FT.a.b}{F_{ab}=
\partial_b\ipr\partial_a\ipr F}
where $F$ is the
\object{EM 2-form FF}{F}
which can be found {\tt From EM potential}
\begin{equation}
F=dA
\end{equation}
or {\tt From EM tensor}
\begin{equation}
F = \frac{1}{2}F_{ab}\,S^{ab}
\end{equation}

The EM action $d$-form
\object{EM Action EMACT}{L_{\rm EM}=
-\frac{1}{8\pi}\,F\wedge *F}

The {\tt Maxwell Equations}
\object{First Maxwell Equation MWFq}{d*F=-4\pi\sigma\,(-1)^{d}\,*J}
\object{Second Maxwell Equation MWSq}{dF=0}

The current must satisfy the
\object{Continuity Equation  COq}{d*J=0}

The
\object{EM Energy-Momentum Tensor  TEM.a.b}{T_{ab}^{\rm EM}}
is given by the equation
\begin{equation}
T^{\rm EM}_{ab} = \frac{\sigma}{4\pi}
F_{am}F_b{}^m +s\sigma\,g_{ab}\,*L_{\rm EM}
\end{equation}

The rest of the section is valid in the dimension 4 only.

In 4 dimensions the tensor $F_{ab}$ and its dual
$\stackrel{*}{F}_{ab}=\frac{1}{2}{\cal E}_{ab}{}^{mn}F_{mn}$
are expressed via usual 3-dimensional vectors $\vec E$ and
$\vec H$
\begin{eqnarray}
F_{ab}&=&-\sigma\left(\begin{array}{rrr}
E_1&E_2&E_3\\
&-H_3&H_2\\
&&-H_1\end{array}\right)\\[1.5mm]
\stackrel{*}{F}_{ab}&=&\sigma\left(\begin{array}{rrr}
H_1&H_2&H_3\\
&E_3&-E_2\\
&&E_1\end{array}\right)
\end{eqnarray}
Similarly for the current we have
\begin{equation}
J=\sigma(-\rho dt + \vec j\,d\vec x)
\end{equation}

The {\tt EM scalars}
\object{First EM Scalar   SCF}{I_1=\frac12F_{ab}F^{ab}
={\vec H}^2-{\vec E}^2}
\object{Second EM Scalar SCS}{I_2=\frac12\stackrel{*}{F}_{ab}F^{ab}
=2\vec E\cdot\vec H}
can be obtained as follows by {\tt Standard way}
\begin{equation}
I_1 = -*(F\wedge*F)
\end{equation}
\begin{equation}
I_2 = *(F\wedge F)
\end{equation}

The
\object{Complex EM 2-form FFU}{\Phi}
can be found {\tt From EM 2-form}
\begin{equation}
\Phi=F-i*F
\end{equation}
or {\tt From EM Spinor}
\begin{equation}
\Phi = 2\Phi_{AB}\,S^{AB}
\end{equation}

The 2-form $\Phi$ must obey the
\object{Selfduality Equation  SDq.AB\cc}{\Phi\wedge S_{\dot A\dot B}}
and gives rise to the
\object{Complex Maxwell Equation MWUq}{d\Phi=-4i\sigma\pi\,*J}

The EM 2-form $F$ can be restored {\tt From Complex EM 2-form}
\begin{equation}
F=\frac{1}{2}(\Phi+\overline\Phi)
\end{equation}

The symmetric
\object{Undotted EM Spinor FIU.AB}{\Phi_{AB}}
is the spinorial analog of the tensor $F_{ab}$
\begin{equation}
 F_{ab} \tsst \epsilon_{AB} \Phi_{\dot A\dot B}
+ \epsilon_{\dot A\dot B} \Phi_{AB}
\end{equation}
It can be obtained either {\tt From complex EM 2-form}
\begin{equation}
\Phi_{AB} = -\frac{i}{2}*(\Phi\wedge S_{AB})
\end{equation}
of {\tt From EM 2-form}
\begin{equation}
\Phi_{AB} = -i*(F\wedge S_{AB})
\end{equation}

The
\object{Complex EM Scalar SCU}{\iota=I_1-iI_2}
can be found {\tt From EM Spinor}
\begin{equation}
\iota = 2\Phi_{AB}\Phi^{AB}
\end{equation}
or {\tt From Complex EM 2-form}
\begin{equation}
\iota = -\frac{i}{2} *(\Phi\wedge\Phi)
\end{equation}

Finally we have the
\object{EM Energy-Momentum Spinor TEMS.AB.CD\cc}
{T^{\rm EM}_{AB\dot A\dot B}=\frac{1}{2\pi}\Phi_{AB}\Phi_{\dot A\dot B}}


\section{Dirac Field}

In this section upper sign corresponds to the
signature ${\scriptstyle(-,+,+,+)}$ and lower one to the
signature ${\scriptstyle(+,-,-,-)}$.

The four component Dirac spinor consists of two 1-index spinors
\begin{equation}
\psi=\left(\begin{array}{c}\phi^A\\ \chi_{\dot A}\end{array}\right),\ \
\overline\psi=\left(\chi_A\ \ \phi^{\dot A}\right)
\end{equation}
Thus we have the {\tt Dirac spinor} as the union of two objects
\object{Phi Spinor     PHI.A}{\phi_A}
\object{Chi Spinor     CHI.B}{\chi_B}

The gamma-matrices are expressed via sigma-matrices as follows
\begin{equation}
\gamma^m=\sqrt2\left(\begin{array}{cc}
0&\sigma^{mA\dot B}\\ \sigma^m\!{}_{B\dot A}&0\end{array}\right)
\end{equation}

Dirac field action 4-form
\begin{eqnarray}
&&\mbox{\tt Dirac Action 4-form  DACT}=L_{\rm D}=\nonumber\\[1mm]
&&\quad=\left[\frac{i}2(\overline\psi\gamma^a
(\nabla_a+ieA_a)\psi-(\nabla_a-ieA_a)\overline\psi\gamma^a\psi)
-m_{\rm D}\overline\psi\psi\right]\upsilon
\end{eqnarray}

The {\tt Standard way} to compute this quantity is
\begin{eqnarray}
L_{\rm D} &=& -\frac{i}{\sqrt2}\left[
\phi_{\dot A}\theta^{A\dot A}\!\wedge*(D+ieA)\phi_A-{\rm c.c.}
-\chi_{\dot A} \theta^{A\dot A}\!\wedge*(D-ieA)\chi_A -{\rm c.c.}\right]-
\nonumber\\[1mm]&&\qquad\qquad\quad
-m_{\rm D}\left(\phi^A\chi_A+{\rm c.c.}\right)\upsilon
\end{eqnarray}

The {\tt Dirac equation} is
\object{Phi Dirac Equation DPq.A\cc}{
i\sqrt2\partial_{B\dot A}\ipr(D+ieA-\frac12Q)\phi^B-m_{\rm D}\chi_{\dot A}=0}
\object{Chi Dirac Equation DCq.A\cc}{
i\sqrt2\partial_{B\dot A}\ipr(D-ieA-\frac12Q)\chi^B-m_{\rm D}\phi_{\dot A}=0}
where $Q$ is the torsion trace 1-form. Notice that terms with the
electromagnetic field $eA$ are included in equations iff
the value of $A$ is defined. The unit charge $e$ is given by the
constant \comm{ECONST}.

The current 1-form can be computed {\tt From Dirac Spinor}
\begin{equation}
J=\mp\sqrt2e(\phi_A\phi_{\dot A}+\chi_A\chi_{\dot A})\theta^{A\dot A}
\end{equation}

The symmetrized
\object{Dirac Energy-Momentum Tensor  TDI.a.b}{T^{\rm D}_{ab}}
can be obtained as follows
\begin{eqnarray}
T^{\rm D}_{ab}&=&
*(\theta_{(a}\wedge T^{\rm D}_{b)})\nonumber\\[1mm]
T^{\rm D}_a&=&\mp\frac{i}{\sqrt2}\Big[
*\theta^{A\dot A}\partial_a\ipr(D+ieA)\phi_A\phi_{\dot A}
-{\rm c.c.}\nonumber\\
&&\qquad-*\theta^{A\dot A}\partial_a\ipr(D-ieA)\chi_A\chi_{\dot A}
-{\rm c.c.}\Big]
\pm\partial_a\ipr L_{\rm D}
\end{eqnarray}

The
\object{Undotted Dirac Spin 3-Form  SPDIU.AB}{s^{\rm D}_{AB}}
\begin{equation}
s^{\rm D}_{AB}=\frac{i}{2\sqrt2}
\left(*\theta_{(A|\dot A}\phi_{B)}\phi^{\dot A}
-*\theta_{(A|\dot A}\chi_{B)}\chi^{\dot A}\right)
\end{equation}

The Dirac field mass $m_{\rm D}$ is given by the constant
\comm{DMASS}.


\section{Scalar Field}

Formulas in this section are valid in any dimension
with the signature ${\scriptstyle(-,+,\dots,+)}$ and
${\scriptstyle(+,-,\dots,-)}$.
The sign factor $\sigma$ is $\sigma=-{\rm diag}_0$
($+1$ for the first signature and $-1$ for the second).

The scalar field
\object{Scalar Field FI}{\phi}

The minimal scalar field action $d$-form
\object{Minimal Scalar Action SACTMIN}{
L_{\rm Smin}=
-\frac{1}{2}\left[\sigma(\partial_\alpha\phi)^2+
m_{\rm s}^2 \phi^2\right]\upsilon}

The nonminimal  scalar field action
\object{Scalar Action SACT}{
L_{\rm S}=
-\frac{1}{2}\left[\sigma(\partial_\alpha\phi)^2+
(m_{\rm s}^2+a_0R) \phi^2\right]\upsilon}

The scalar field equation
\object{Scalar Equation SCq}
{s\sigma(-1)^d*d*d\phi-(m_{\rm s}^2+a_0R)\phi=0}
which gives
\[
-\sigma\rim{\nabla}{}^\pi\rim{\nabla}_\pi\phi-(m_{\rm s}^2+a_0R)\phi=0
\]

The minimal energy-momentum tensor is
\begin{eqnarray}
&&\mbox{\tt Minimal Scalar Energy-Momentum Tensor TSCLMIN.a.b}
=T^{\rm Smin}_{ab}= \nonumber\\
&&\qquad\qquad=\partial_a\phi\partial_b\phi+s\sigma\,g_{ab}
*L_{\rm Smin}
\end{eqnarray}
The nonminimal part of the scalar field energy-momentum
\seethis{See pages \pageref{graveq}\ and \pageref{metreq}.}
tensor can be taken into account in the left-hand side
of gravitational equations.

The scalar field mass $m_{\rm s}$ are given by the
constant {\tt SMASS}. The nonminimal interaction
terms are included iff the switch \comm{NONMIN} \swind{NONMIN}
is turned on and the value of nonminimal interaction constant
$a_0$ is determined by the object
\object{A-Constants  ACONST.i2}{a_i}
The default value of $a_0$ is the constant \comm{AC0}.

\section{Yang-Mills Field}

Formulas in this section are valid in any dimension
with the signature ${\scriptstyle(-,+,\dots,+)}$ and
${\scriptstyle(+,-,\dots,-)}$.
The sign factor $\sigma$ in the expressions below is
$\sigma=-{\rm diag}_0$ ($+1$ for the first signature and $-1$
for the second). The indices $\scriptstyle i,j,k,l,m,n$
are the internal space Yang-Mills indices and we a
assume that the internal Yang-Mills metric is $\delta_{ij}$.

The Yang-Mills potential 1-form
\object{YM Potential AYM.i9}{A^i=A^i_\mu dx^\mu}

The structural constants
\object{Structural Constants SCONST.i9.j9.k9}{c^i{}_{jk}=c^i{}_{[jk]}}

The Yang-Mills strength 2-form
\object{YM 2-form  FFYM.i9}{F^i}
and strength tensor
\object{YM Tensor  FTYM.i9.a.b}{F^i{}_{ab}}

The $F^i$ can be computed {\tt From YM potential}
\begin{equation}
F^i = dA^i + \frac12 c^i{}_{jk} \, A^j\wedge A^k
\end{equation}
or {\tt From YM tensor}
\begin{equation}
F^i = \frac12 F^i{}_{ab}\, S^{ab}
\end{equation}

The {\tt Standard way} to find Yang-Mills strength tensor is
\begin{equation}
F^i{}_{ab}=\partial_b\ipr\partial_a\ipr F^i
\end{equation}

The Yang-Mills action $d$-form
\object{YM Action YMACT}{L_{\rm YM}=
-\frac{1}{8\pi}F^i\wedge*F_i}

The {\tt YM Equations}
\object{First YM Equation YMFq.i9}{d*F^i + c^i{}_{jk} \, A^j\wedge *F^k=0}
\object{Second YM Equation YMSq.i9}{dF^i + c^i{}_{jk} \, A^j\wedge F^k=0}

The energy-momentum tensor
\object{YM Energy-Momentum Tensor TYM.a.b}
{\frac{\sigma}{4\pi}F^i{}_{am}F^i{}_b{}^m + s\sigma\,g_{ab}\,
*L_{\rm YM}}


\section{Geodesics}

The geodesic equation
\object{Geodesic Equation GEOq\^m}{
\frac{d^2x^\mu}{dt^2}+\{^\mu_{\pi\tau}\}
\frac{dx^\pi}{dt}\frac{dx^\tau}{dt}=0}
Here the parameter $t$ must be declared by the
\seethis{See page \pageref{affpar}.}
\cmdind{Affine Parameter}
{\tt Affine parameter} declaration.

\section{Null Congruence and Optical Scalars}

Let us consider the congruence defined by the vector field
$k^\alpha$
\object{Congruence KV}{k=k^\mu\partial_\mu}

This congruence is null iff
\object{Null Congruence Condition NCo}{k\cdot k=0}
holds.

The congruence is geodesic iff the condition
\object{Geodesics Congruence Condition GCo'a}{k^\mu\rim{\nabla}_\mu k^a=0}
is fulfilled.

For the null geodesic congruence one can calculate the
{\tt Optical scalars}
\object{Congruence Expansion thetaO}{\theta=
\frac{1}{2}\rim{\nabla}{}^\pi k_\pi}
\object{Congruence Squared Rotation omegaSQO}{\omega^2=
\frac{1}{2}(\rim{\nabla}_{[\alpha}k_{\beta]})^2}
\object{Congruence Squared Shear sigmaSQO}{\sigma\overline\sigma=
\frac{1}{2}\left[ (\rim{\nabla}_{(\alpha}k_{\beta)})^2
-2\theta^2\right]}

\section{Timelike Congruences and Kinematics}

Let us consider the congruence determined by the velocity
vector $u^\alpha$
\object{Velocity UU'a}{u^a}
\object{Velocity Vector UV}{u=u^a\partial_a}

The velocity vector must be normalized and the quantity
\object{Velocity Square USQ}{u^2=u\cdot u}
must be constant but nonzero.

If the frame metric coincides with its default
diagonal value \seethis{See \pref{defaultmetric}.}
$g_{ab}={\rm diag}(-1,\dots)$
then {\tt By default} we have for the velocity
\begin{equation}
u^a=(1,0,\dots,0)
\end{equation}
which means that the congruence is comoving in the given frame.

In general case the velocity can be obtained
{\tt From velocity vector}
\begin{equation}
u^a=u\ipr \theta^a
\end{equation}

We introduce the auxiliary object
\object{Projector PR'a.b}{P^a{}_b=
\delta^a_b-\frac{1}{u^2}u^an_b}

The following four quantities called {\tt Kinematics}
comprise the complete set of the congruence characteristics
\object{Acceleration accU'a}{A^a=\rim{\nabla}_uu^a}
\object{Vorticity omegaU.a.b}{\omega_{ab}=
P^m{}_aP^n{}_b \rim{\nabla}_{[m}u_{n]}}
\object{Volume Expansion thetaU}{\Theta=\rim{\nabla}_au^a}
\object{Shear sigmaU.a.b}{
P^m{}_aP^n{}_b \rim{\nabla}_{(m}u_{n)}-
\frac{1}{(d-1)}P_{ab}\Theta}


\section{Ideal And Spin Fluid}


The ideal fluid is characterized by the
\object{Pressure PRES}{p}
and
\object{Energy Density ENER}{\varepsilon}

The ideal fluid energy-momentum tensor is
\begin{eqnarray}
&&\mbox{\tt Ideal Fluid Energy-Momentum Tensor  TIFL.a.b}=
T^{\rm IF}_{ab} = \nonumber\\
&&\qquad\qquad=(\varepsilon+p)u_a u_b - u^2p g_{ab}
\end{eqnarray}

The rest of the section requires the nonmetricity be zero
(\comm{NONMETR} is off).

In addition  spin-fluid is characterized by
\object{Spin Density SPFLT.a.b }{S^{\rm SF}_{ab}=S^{\rm SF}_{[ab]}}
or equivalently by
\object{Spin Density 2-form SPFL }{S^{\rm SF}}

The spin 2-form can be obtained {\tt From spin density}
\begin{equation}
S^{\rm SF}=\frac{1}{2}S^{\rm SF}_{ab} \theta^a\wedge\theta^a
\end{equation}
and $s_{ab}$ is determined {\tt From spin density 2-form}
\begin{equation}
S^{\rm SF}_{ab}= \partial_b\ipr\partial_a\ipr S^{\rm SF}
\end{equation}

The spin density must satisfy the Frenkel condition
\object{Frenkel Condition FCo}{u\ipr S^{\rm SF}=0}

The spin fluid energy-momentum tensor is
\begin{eqnarray}
&&\mbox{\tt Spin Fluid Energy-Momentum Tensor TSFL.a.b}=T^{\rm SF}_{ab}=
\nonumber\\
&&\qquad\qquad=(\varepsilon+p)u_a u_b - u^2p g_{ab}+\Delta_{(ab)}
\end{eqnarray}
where
\begin{equation}
\Delta_{ab}=-2(g^{cd}+u^{-2}\,u^cu^d) \nabla_c S^{\rm SF}_{(ab)d}
\end{equation}
\begin{equation}
s^{\rm SF}_{abc}=u_a\,S^{\rm SF}_{bc}
\end{equation}
if torsion is zero (\comm{TORSION} off) and
\begin{equation}
\Delta_{ab}=2u^{-2}\,u_au^d\,\nabla_u S^{\rm SF}_{bd}
\end{equation}
if torsion is nonzero (\comm{TORSION} on).

Notice that the energy-momentum \seethis{See \pref{tsym}.}
tensor $T^{\rm SF}_{ab}$ is symmetrized.

Finally yet another representation for the spin
is the undotted spin 3-form
\object{Undotted Fluid Spin 3-form SPFLU.AB }{s^{\rm SF}_{AB}}
which is given by the standard spinor $\tsst$ tensor correspondence rules
\begin{equation}
 s^{\rm SF}_{mab}\,*\theta^m \tsst \epsilon_{AB} s^{\rm SF}_{\dot A\dot B}
+ \epsilon_{\dot A\dot B}s^{\rm SF}_{AB}
\end{equation}
according to Eq. (\ref{asys}). \seethis{See \pref{asys}.}
This quantity is used in the right-hand side of gravitational equations.

\section{Total Energy-Momentum And Spin}
\label{totalc}

\enlargethispage{4mm}


The total energy-momentum tensor
\object{Total Energy-Momentum Tensor TENMOM.a.b}{T_{ab}}
and the total undotted spin 3-form \seethis{See pages \pageref{graveq}\ and \pageref{metreq}.}
\object{Total Undotted Spin 3-form SPINU.AB}{s_{AB}}
play the role of sources in the right-hand side of the
gravitational equations.

The expression for these quantities read
\begin{equation}
T_{ab} =
T^{\rm D}_{ab}+
T^{\rm EM}_{ab}+
T^{\rm YM}_{ab}+
T^{\rm Smin}_{ab}+
T^{\rm IF}_{ab}+
T^{\rm SF}_{ab}  \label{b1}
\end{equation}
\begin{equation}
s_{AB} = s_{AB}^{\rm D} + s_{AB}^{\rm SF} \label{b2}
\end{equation}
When $T_{ab}$ and
$s_{AB}$ are calculated \grg\ does not tries to find value
of all objects in the right-hand side of Eqs. (\ref{b1}), (\ref{b2})
instead it adds only the quantities whose value are currently
defined. In particular if none of above tensors and spinors are
defined then $T_{ab}=s_{AB}=0$.

Notice that $T_{ab}$ and all tensors in the right-hand side
of Eq. (\ref{b1}) are symmetric.
\seethis{See \pref{tsym}.}
They are the symmetric parts of the canonical energy-momentum tensors.

In addition we introduce the
\object{Total Energy-Momentum Trace TENMOMT}{T=T^a{}_a}
and the spinor
\object{Total Energy-Momentum Spinor TENMOMS.AB.CD\cc}{T_{AB\dot C\dot D}}
is a spinorial equivalent of the traceless part of $T_{ab}$
\begin{equation}
T_{ab}-\frac{1}{4}g_{ab}T \tsst T_{AB\dot A\dot B}
\end{equation}


\section{Einstein Equations}

The Einstein equation
\object{Einstein Equation EEq.a.b}
{R_{ab}-\frac{1}{2}g_{ab}R +\Lambda R =8\pi G\, T_{ab}}

And the {\tt Spinor Einstein equations}
\object{Traceless Einstein Equation CEEq.AB.CD\cc}{
C_{AB\dot C\dot D} = 8\pi G\, T_{AB\dot C\dot D}}
\object{Trace of Einstein Equation TEEq}
{R-4\Lambda = -8\pi G\, T}

The cosmological constant is included in these equations
iff the switch \comm{CCONST} is turned on \swind{CCONST}
and its value is given by the constant \comm{CCONST}.
The gravitational constant $G$ is given by the constant \comm{GCONST}.


\section{Gravitational Equations in Space With Torsion}

Equations in this section are valid in dimension $d=4$
with the signature ${\scriptstyle(-,+,+,+)}$ and
${\scriptstyle(+,-,-,-)}$ only.
The $\sigma=1$ for the first signature and $\sigma=-1$
for the second. The nonmetricity must be zero and the
switch \comm{NONMETR} turned off.

Let us consider the action
\begin{equation}
S=\int\left[\frac{\sigma}{16\pi G}L_{\rm g}
+L_{\rm m}\right]
\end{equation}
where
\object{Action LACT}{L_{\rm g}=\upsilon\,{\cal L}_{\rm g}}
is the gravitational action 4-form and
\begin{equation}
L_{\rm m} = \upsilon\,{\cal L}_{\rm m}
\end{equation}
is the matter action 4-form.

Let us define the following variational derivatives
\begin{equation}
Z^\mu{}_{a} = \frac{1}{\sqrt{-g}}
\frac{\delta\sqrt{-g}{\cal L}_{\rm g}}{\delta h^a_\mu}
,\qquad
t^\mu{}_{a} = \frac{\sigma}{\sqrt{-g}}
\frac{\delta\sqrt{-g}{\cal L}_{\rm m}}{\delta h^a_\mu}
\end{equation}
\begin{equation}
V^\mu{}_{ab} = \frac{1}{\sqrt{-g}}
\frac{\delta\sqrt{-g}{\cal L}_{\rm g}}{\delta \omega^{ab}{}_\mu}
,\qquad
s^\mu{}_{ab} = \frac{\sigma}{\sqrt{-g}}
\frac{\delta\sqrt{-g}{\cal L}_{\rm m}}{\delta \omega^{ab}{}_\mu}
\end{equation}
Then the gravitational equations reads
\begin{eqnarray}
Z^\mu{}_a &=& -16\pi G\,t^\mu{}_a  \label{zma} \\[2mm]
V^\mu{}_{ab} &=& -16\pi G\,s^\mu{}_{ab}  \label{vab}
\end{eqnarray}
Here the first equation is an analog of Einstein equation
and has the canonical nonsymmetric energy-momentum
tensor $t^\mu{}_a$ as a source. The source in the second
equation is the spin tensor $s^\mu{}_{ab}$.

Now we rewrite these equation in other equivalent form.
First let us define the following 3-forms
\begin{equation}
Z_a = Z^m{}_a\,*\theta_m,\qquad t_a = t^m{}_a\,*\theta_m
\end{equation}
\begin{equation}
V_{ab} = V^m{}_{ab}\,*\theta_m,\qquad s_{ab} = s^m{}_{ab}\,*\theta_m
\end{equation}
Notice that Eq. (\ref{zma}) is not symmetric but \label{tsym}
the antisymmetric part of this equation is expressed via second
Eq. (\ref{vab}) due to Bianchi identity. Therefore only the
symmetric part of Eq. (\ref{zma}) is essential.
Eq. (\ref{vab}) is
antisymmetric and we can consider its spinorial analog
using the standard relations
\begin{eqnarray}
V_{ab} &\tsst& V_{A\dot AB\dot B}=
\epsilon_{AB} V_{\dot A\dot B} + \epsilon_{\dot A\dot B}V_{AB} \\
s_{ab} &\tsst& s_{A\dot AB\dot B}=
\epsilon_{AB} s_{\dot A\dot B} + \epsilon_{\dot A\dot B}s_{AB}
\end{eqnarray}  \seethis{See \pref{asys}.}

Finally we define the {\tt Gravitational equations} in the form \label{graveq}
\object{Metric Equation METRq.a.b}{-\frac12Z_{(ab)}=8\pi G\,T_{ab}}
\object{Torsion Equation TORSq.AB}{V_{AB}=-16\pi G\,s_{AB}}
where the currents in the right-hand side of equations are
\seethis{See \pref{totalc}.}
\object{Total Energy-Momentum Tensor TENMOM.a.b}{T_{ab}=t_{(ab)}}
\object{Total Undotted Spin 3-form SPINU.AB}{s_{AB}}

Now let us consider the equations which are used in \grg\ to
compute the left-hand side of the gravitational equations
$Z_{(ab)}$ and $V_{AB}$. We have to emphasize that we use
\seethis{See \pref{spinors}.}
spinors and all restrictions imposed by the spinorial formalism
must be fulfilled.

We consider the Lagrangian which is an arbitrary algebraic function
of the curvature and torsion tensors
\begin{equation}
{\cal L}_{\rm g} = {\cal L}_{\rm g}(R_{abcd},Q_{abc})
\end{equation}
No derivatives of the torsion or curvature are permitted.
For such a Lagrangian we define so called curvature and torsion
momentums
\begin{equation}
\widetilde{R}{}^{abcd} =
2\frac{\partial{\cal L}_{\rm g}(R,Q)}{\partial R_{abcd}},\qquad
\widetilde{Q}{}^{abc} =
2\frac{\partial{\cal L}_{\rm g}(R,Q)}{\partial Q_{abc}},\qquad
\end{equation}

The corresponding objects are
\object{Undotted Curvature Momentum  POMEGAU.AB}{\widetilde{\Omega}_{AB}}
\object{Torsion Momentum             PTHETA'a}{\widetilde{\Theta}{}^a}
where
\begin{eqnarray}
\widetilde{\Omega}_{ab}   &=& \frac12   \widetilde{R}_{abcd}\,S^{cd} \\[1mm]
\widetilde{\Theta}{}^a  &=& \frac12   \widetilde{Q}{}^a{}_{cd}\,S^{cd}
\end{eqnarray}
and
\begin{equation}
\widetilde{\Omega}_{ab} \tsst \widetilde{\Omega}_{A\dot AB\dot B}=
\epsilon_{AB} \widetilde{\Omega}_{\dot A\dot B}
+ \epsilon_{\dot A\dot B}\widetilde{\Omega}_{AB}
\end{equation}

If value of three objects $L_{\rm g}$ ({\tt Action}),
$\widetilde{\Omega}_{AB}$ ({\tt Undotted curvature momentum})
and $\widetilde{\Theta}{}^a$ are specified then the
{\tt Gravitational equations} can be calculated using equations
({\tt Standard way})
\begin{eqnarray}
Z_{(ab)} &=& *(\theta_{(a}\wedge Z_{b)}),\nonumber\\[1mm]
Z_a &=& D\widetilde{\Theta}_a
        + (\partial_a\ipr\Theta^b)\wedge\widetilde{\Theta}_b
        +2(\partial_a\ipr\Omega^{MN})\wedge\widetilde{\Omega}_{MN}
\nonumber\\
&&        + {\rm c.c.}-\partial_a L_{\rm g}
\end{eqnarray}
\begin{eqnarray}
&&V_{AB} = -D\widetilde{\Omega}_{AB} - \widetilde{\Theta}_{AB},\nonumber\\[1mm]
&&
\theta_{[a}\wedge\widetilde{\Theta}_{b]} \tsst
\epsilon_{AB} \widetilde{\Theta}_{\dot A\dot B}
+ \epsilon_{\dot A\dot B}\widetilde{\Theta}_{AB}
\end{eqnarray}

Since gravitational equations are computed in the
spinorial formalism with the standard null frame
\seethis{See pages \pageref{spinors}\ and \pageref{spinors1}.}
the metric equation is complex and components $\scriptstyle02$,
$\scriptstyle12$, $\scriptstyle22$  are conjugated to $\scriptstyle03$.
$\scriptstyle13$, $\scriptstyle33$. Since these components are not independent
For the sake of efficiency by default \grg\ computes only
the $\scriptstyle00$, $\scriptstyle01$, $\scriptstyle02$,
$\scriptstyle11$, $\scriptstyle12$, $\scriptstyle22$ and $\scriptstyle23$
components of $Z_{(ab)}$ only.
If you want to have all components the switch \comm{FULL} must be
turned on. \swind{FULL}

These equations allows one to compute field equations for
gravity theory with an arbitrary Lagrangian.
But the value of three quantities  $L_{\rm g}$,
$\widetilde{\Omega}_{AB}$ and $\widetilde{\Theta}{}^a$
must be specified by the user. In addition \grg\ has built-in
formulas for the most general quadratic in torsion and curvature
Lagrangian. The {\tt Standard way} for $L_{\rm g}$,
$\widetilde{\Omega}_{AB}$ and $\widetilde{\Theta}{}^a$ is \label{thetau}
\begin{eqnarray}
\widetilde{\Theta}{}^a &=&
i\mu_1 (\stackrel{\scriptscriptstyle\rm c}{\vartheta}{}^a  -{\rm c.c.})
+i\mu_2 (\stackrel{\scriptscriptstyle\rm t}{\vartheta}{}^a -{\rm c.c.})
+i\mu_3 (\stackrel{\scriptscriptstyle\rm a}{\vartheta}\!{}^a -{\rm c.c.}), \\[2mm]
\widetilde{\Omega}_{AB} &=&
i(\lambda_0-\sigma\,8\pi G\, a_0\phi^2)\, S_{AB} \nonumber\\&&
+i\lambda_1 \OO{w}_{AB}
-i\lambda_2 \OO{c}_{AB}
+i\lambda_3 \OO{r}_{AB}  \nonumber\\&&
+i\lambda_4 \OO{a}_{AB}
-i\lambda_5 \OO{b}_{AB}
+i\lambda_6 \OO{d}_{AB} , \\[2mm]
L_{\rm g} &=& (-2\Lambda +\frac{1}{2}\lambda_0R
-\sigma\,4\pi G a_0 \phi^2 R) \upsilon
+ \Omega^{AB}\wedge\widetilde{\Omega}_{AB} + {\rm c.c.} \nonumber\\&&
+ \frac{1}{2} \Theta^a\wedge\widetilde{\Theta}_a
\end{eqnarray}

The cosmological term $\Lambda$ is included into
equations iff the switch \comm{CCONST} is turned on \swinda{CCONST}
and the value of $\Lambda$ is given by the constant \comm{CCONST}.
The term with the scalar field $\phi$ is included into
equations iff the switch \comm{NONMIN} is on. \swinda{NONMIN}
The gravitational constant $G$ is given by the constant \comm{GCONST}.
The parameters of the quadratic Lagrangian are given by the objects
\object{L-Constants   LCONST.i6}{\lambda_i}
\object{M-Constants   MCONST.i3}{\mu_i}
\object{A-Constants  ACONST.i2}{a_i}
The default value of these objects ({\tt Standard way}) is
\begin{eqnarray}
\lambda_i &=& (\mbox{\tt LC0},\mbox{\tt LC1},\mbox{\tt LC2},\mbox{\tt LC3},\mbox{\tt LC4},\mbox{\tt LC5},\mbox{\tt LC6}), \\
\mu_i &=& (0,\mbox{\tt MC1},\mbox{\tt MC2},\mbox{\tt MC32}), \\
a_i &=& (\mbox{\tt AC0},0,0)
\end{eqnarray}

\section{Gravitational Equations in Riemann Space}

Equations in this section are valid in dimension $d=4$
with the signature ${\scriptstyle(-,+,+,+)}$ and
${\scriptstyle(+,-,-,-)}$ only.
The $\sigma=1$ for the first signature and $\sigma=-1$
for the second. The nonmetricity and torsion must be zero and the
switches \comm{NONMETR} and \comm{TORSION} must be turned off.

Let us consider the action
\begin{equation}
S=\int\left[\frac{\sigma}{16\pi G}L_{\rm g}
+L_{\rm m}\right]
\end{equation}
where
\object{Action LACT}{L_{\rm g}=\upsilon\,{\cal L}_{\rm g}}
is the gravitational action 4-form and
\begin{equation}
L_{\rm m} = \upsilon\,{\cal L}_{\rm m}
\end{equation}
is the matter action 4-form.

Let us define the following variational derivatives
\begin{equation}
Z^\mu{}_{a} = \frac{1}{\sqrt{-g}}
\frac{\delta\sqrt{-g}{\cal L}_{\rm g}}{\delta h^a_\mu}
,\qquad
T^\mu{}_{a} = \frac{\sigma}{\sqrt{-g}}
\frac{\delta\sqrt{-g}{\cal L}_{\rm m}}{\delta h^a_\mu}
\end{equation}
Then the {\tt Metric equation} is \label{metreq}
\object{Metric Equation METRq.a.b}{-\frac12Z_{ab}=8\pi G\,T_{ab}}
Notice that $Z_{ab}$ and $T_{ab}$ are automatically symmetric.

Let us define 3-form
\begin{equation}
Z_a = Z^m{}_a\,*\theta_m,\qquad t_a = t^m{}_a\,*\theta_m
\end{equation}

Now we consider the equations which are used in \grg\ to
compute the left-hand side of the metric equation
$Z_{ab}$. We have to emphasize that we use
spinors and all restrictions imposed by the spinorial formalism
\seethis{See pages \pageref{spinors}\ or \pageref{spinors1}.}
must be fulfilled.

We consider the Lagrangian which is an arbitrary algebraic function
of the curvature tensor
\begin{equation}
{\cal L}_{\rm g} = {\cal L}_{\rm g}(R_{abcd})
\end{equation}
No derivatives of the curvature are permitted.
For such a Lagrangian we define so called curvature momentum
\begin{equation}
\widetilde{R}{}^{abcd} =
2\frac{\partial{\cal L}_{\rm g}(R)}{\partial R_{abcd}}
\end{equation}

The corresponding \grg\ built-in object is
\object{Undotted Curvature Momentum  POMEGAU.AB}{\widetilde{\Omega}_{AB}}
where
\begin{eqnarray}
\widetilde{\Omega}_{ab}   &=& \frac12   \widetilde{R}_{abcd}\,S^{cd} \\[1mm]
\end{eqnarray}
and
\begin{equation}
\widetilde{\Omega}_{ab} \tsst \widetilde{\Omega}_{A\dot AB\dot B}=
\epsilon_{AB} \widetilde{\Omega}_{\dot A\dot B}
+ \epsilon_{\dot A\dot B}\widetilde{\Omega}_{AB}
\end{equation}

If value of the objects $L_{\rm g}$ ({\tt Action}) and
$\widetilde{\Omega}_{AB}$ ({\tt Undotted curvature momentum}) is specified
then the {\tt Metric equation} can be calculated using equations
({\tt Standard way})
\begin{eqnarray}
Z_{ab} &=& *(\theta_{(a}\wedge Z_{b)}),\nonumber\\[1mm]
Z_a  &=& D [
2\partial_m\ipr D\widetilde{\Omega}_a{}^{m}
-{\frac{1}{2}}\theta_a\!\wedge
(\partial_m\ipr\partial_n\ipr D\widetilde{\Omega}{}^{mn})]
\nonumber\\&&
        +2(\partial_a\ipr\Omega^{MN})\wedge\widetilde{\Omega}_{MN}
        + {\rm c.c.}-\partial_a L_{\rm g}
\end{eqnarray}

Since gravitational equations are computed in the
spinorial formalism with the standard null frame
\seethis{See \pref{spinors}\ or \pref{spinors1}.}
the metric equation is complex and components $\scriptstyle02$,
$\scriptstyle12$, $\scriptstyle22$  are conjugated to $\scriptstyle03$,
$\scriptstyle13$, $\scriptstyle33$.
For the sake of efficiency by default \grg\ computes only
the components $\scriptstyle00$, $\scriptstyle01$, $\scriptstyle02$,
$\scriptstyle11$, $\scriptstyle12$, $\scriptstyle22$ and $\scriptstyle23$
only. If you want to have all components the switch \comm{FULL} must be
turned on. \swinda{FULL}

These equations allows one to compute field equations for
gravity theory with an arbitrary Lagrangian.
But the value of three quantities  $L_{\rm g}$ and
$\widetilde{\Omega}_{AB}$ must be specified by user.
In addition \grg\ has built-in
formulas for the most general quadratic in  the curvature
Lagrangian. The {\tt Standard way} for $L_{\rm g}$ and
$\widetilde{\Omega}_{AB}$ is
\begin{eqnarray}
\widetilde{\Omega}_{AB} &=&
i(\lambda_0-\sigma8\pi G\, a_0\phi^2)\, S_{AB} \nonumber\\&&
+i\lambda_1 \OO{w}_{AB}
-i\lambda_2 \OO{c}_{AB}
+i\lambda_3 \OO{r}_{AB}, \\[2mm]
L_{\rm g} &=& (-2\Lambda +{\frac{1}{2}}\lambda_0R
-\sigma4\pi G a_0 \phi^2 R) \upsilon
+ \Omega^{AB}\wedge\widetilde{\Omega}_{AB} + {\rm c.c.}
\end{eqnarray}

The cosmological term is included into
equations iff the switch \comm{CCONST} is on \swinda{CCONST}
and the value of $\Lambda$ is given by the constant \comm{CCONST}.
The term with the scalar field $\phi$ is included into
equations iff the switch \comm{NONMIN} is on. \swinda{NONMIN}
The gravitational constant $G$ is given by the constant \comm{GCONST}.
The parameters of the quadratic lagrangian are given by the object
\object{L-Constants   LCONST.i6}{\lambda_i}
\object{A-Constants  ACONST.i2}{a_i}
The default value of these objects ({\tt Standard way}) is
\begin{eqnarray}
\lambda_i &=& (\mbox{\tt LC0},\mbox{\tt LC1},\mbox{\tt LC2},\mbox{\tt LC3},\mbox{\tt LC4},\mbox{\tt LC5},\mbox{\tt LC6}), \\
a_i &=& (\mbox{\tt AC0},0,0)
\end{eqnarray}



\appendix

\chapter{\grg\ Switches}\vspace*{-6mm}
\index{Switches}

\tabcolsep=1.5mm

\begin{tabular}{|c|c|l|c|}
\hline
Switch & Default &\qquad Description  & See \\
       & State &                                & page\\
\hline
\tt  AEVAL          & Off & Use {\tt AEVAL} instead of {\tt REVAL}.  &\pageref{AEVAL}\\
\tt  WRS            & On  & Re-simplify object before printing.      &\pageref{WRS}\\
\tt  WMATR          & Off & Write 2-index objects in matrix form.    &\pageref{WMATR}\\
\tt  TORSION        & Off & Torsion.                                 &\pageref{TORSION}\\
\tt  NONMETR        & Off & Nonmetricity.                            &\pageref{NONMETR}\\
\tt  UNLCORD        & On  & Save coordinates in {\tt Unload}.        &\pageref{UNLCORD}\\
\tt  AUTO           & On  & Automatic object calculation in expressions.      &\pageref{AUTO}\\
\tt  TRACE          & On  & Trace the calculation process.           &\pageref{TRACE}\\
\tt  SHOWCOMMANDS   & Off & Show compound command expansion.         &\pageref{SHOWCOMMANDS}\\
\tt  EXPANDSYM      & Off & Enable {\tt Sy Asy Cy} in expressions    &\pageref{EXPANDSYM}\\
\tt  DFPCOMMUTE     & On  & Commutativity of {\tt DFP} derivatives.              &\pageref{DFPCOMMUTE}\\
\tt  NONMIN         & Off & Nonminimal interaction for scalar field.    &\pageref{NONMIN}\\
\tt  NOFREEVARS     & Off & Prohibit free variables in {\tt Print}.  &\pageref{NOFREEVARS}\\
\tt  CCONST         & Off & Include cosmological constant in equations.     &\pageref{CCONST}\\
\tt  FULL           & Off & Number of components in {\tt Metric Equation}. &\pageref{FULL}\\
\tt  LATEX          & Off &  \LaTeX\ output mode.                    &\pageref{LATEX}\\
\tt  GRG            & Off &  \grg\ output mode.                      &\pageref{GRG}\\
\tt  REDUCE         & Off &  \reduce\ output mode.                   &\pageref{REDUCE}\\
\tt  MAPLE          & Off &  {\sc Maple} output mode.                &\pageref{MAPLE}\\
\tt  MATH           & Off &  {\sc Mathematica} output mode.          &\pageref{MATH}\\
\tt  MACSYMA        & Off &  {\sc Macsyma} output mode.              &\pageref{MACSYMA}\\
\tt  DFINDEXED      & Off & Print {\tt DF} in index notation.        &\pageref{DFINDEXED}\\
\tt  BATCH          & Off & Batch mode.                              &\pageref{BATCH}\\
\tt  HOLONOMIC      & On  & Keep frame holonomic.       &\pageref{HOLONOMIC}\\
\tt  SHOWEXPR       & Off & Print expressions during algebraic       &\pageref{SHOWEXPR}\\
\tt                 &     & classification.                          &\\
\hline
\end{tabular}

\chapter{Macro Objects}
\index{Macro Objects}

Macro objects can be used in expression, in {\tt Write} and
{\tt Show} commands but not in the {\tt Find} command.
The notation for indices is the same as in the {\tt New Object}
declaration (see page \pageref{indices}).

\begin{center}

\section{Dimension and Signature}

\begin{tabular}{|l|l|}
\hline
\tt  dim       &  Dimension $d$ \\
\hline
\tt  sdiag.idim & {\tt sdiag(\parm{n})} is the $n$'th element of the \\
                &  signature diag($-1,+1$\dots) \\
\hline
\tt  sign      &  Product of the signature specification \\
\tt  sgnt      &  elements $\prod_{n=0}^{d-1}\mbox{\tt sdiag(}n\mbox{\tt)}$ \\[1mm]
\hline
\tt  mpsgn     &  {\tt sdiag(0)}  \\
\tt  pmsgn     &  {\tt -sdiag(0)}   \\
\hline
\end{tabular}

\section{Metric and Frame}

\begin{tabular}{|l|l|}
\hline
\tt  x\^m        &  $m$'th coordinate                   \\
\tt  X\^m        &                     \\
\hline
\tt  h'a\_m    &  Frame coefficients         \\
\tt  hi.a\^m   &                    \\
\hline
\tt  g\_m\_n    & Holonomic metric      \\
\tt  gi\^m\^n   &                   \\
\hline
\end{tabular}

\section{Delta and Epsilon Symbols}

\begin{tabular}{|l|l|}
\hline
\tt  del'a.b       &  Delta symbols   \\
\tt  delh\^m\_n    &                  \\
\hline
\tt  eps.a.b.c.d   &  Totally antisymmetric symbols \\
\tt  epsi'a'b'c'd  &  (number of indices depend on $d$)  \\
\tt  epsh\_m\_n\_p\_q  &                     \\
\tt  epsih\^m\^n\^p\^q &                     \\
\hline
\end{tabular}

\section{Spinors}

\begin{tabular}{|l|l|}
\hline
\tt  DEL'A.B      & Delta symbol          \\
\hline
\tt  EPS.A.B      & Spinorial metric      \\
\tt  EPSI'A'B     &                       \\
\hline
\tt  sigma'a.A.B\cc   & Sigma matrices      \\
\tt  sigmai.a'A'B\cc  &                    \\
\hline
\tt  cci.i3    & Frame index conjugation in standard null frame \\
	       & {\tt cci(0)=0}\ {\tt cci(1)=1}\ {\tt cci(2)=3}\ {\tt cci(3)=2} \\
\hline
\end{tabular}

\section{Connection Coefficients}

\begin{tabular}{|l|l|}
\hline
\tt  CHR\^m\_n\_p  &  Christoffel symbols $\{{}^\mu_{\nu\pi}\}$ \\
\tt  CHRF\_m\_n\_p &  and $[{}_{\mu},_{\nu\pi}]$  \\
\tt  CHRT\_m       &  Christoffel symbol trace $\{{}^\pi_{\pi\mu}\}$  \\
\hline
\tt  SPCOEF.AB.c     & Spin coefficients $\omega_{AB\,c}$  \\
\hline
\end{tabular}

\section{NP Formalism}

\begin{tabular}{|l|c|}
\hline
\tt  PHINP.AB.CD~ &  $\Phi_{AB\dot{c}\dot{D}}$  \\
\tt  PSINP.ABCD   &  $\Psi_{ABCD}$              \\
\hline
\tt  alphanp      & $\alpha$ \\
\tt  betanp       & $\beta$ \\
\tt  gammanp      & $\gamma$ \\
\tt  epsilonnp    & $\epsilon$ \\
\tt  kappanp      & $\kappa$ \\
\tt  rhonp        & $\rho$ \\
\tt  sigmanp      & $\sigma$ \\
\tt  taunp        & $\tau$ \\
\tt  munp         & $\mu$ \\
\tt  nunp         & $\nu$ \\
\tt  lambdanp     & $\lambda$ \\
\tt  pinp         & $\pi$ \\
\hline
\tt  DD           & $D$ \\
\tt  DT           & $\Delta$ \\
\tt  du           & $\delta$ \\
\tt  dd           & $\overline\delta$ \\
\hline
\end{tabular}

\end{center}

\chapter{Objects}

Here we present the complete list of built-in objects
with names and identifiers.
The notation for indices is the same as in the
{\tt New Object} declaration (see page \pageref{indices}).
Some names (group names) refer to a set of objects.
For example the group name {\tt Spinorial S - forms} below
denotes {\tt SU.AB} and {\tt SD.AB\cc}

\begin{center}


\section{Metric, Frame, Basis, Volume \dots}
\begin{tabular}{|l|l|}\hline
\tt    Frame                   &\tt   T'a\\
\tt    Vector Frame            &\tt   D.a\\
\hline
\tt    Metric                  &\tt   G.a.b\\
\tt    Inverse Metric          &\tt   GI'a'b\\
\tt    Det of Metric           &\tt   detG\\
\tt    Det of Holonomic Metric &\tt   detg\\
\tt    Sqrt Det of Metric      &\tt   sdetG\\
\hline
\tt    Volume                  &\tt   VOL\\
\hline
\tt    Basis                   &\tt   b'idim \\
\tt    Vector Basis            &\tt   e.idim \\
\hline
\tt    S-forms                 &\tt   S'a'b\\
\hline
\multicolumn{2}{|c|}{\tt Spinorial S-forms} \\
\tt    Undotted S-forms   &\tt    SU.AB\\
\tt    Dotted S-forms     &\tt    SD.AB\cc\\
\hline\end{tabular}

\section{Rotation Matrices}
\begin{tabular}{|l|l|}\hline
\tt    Frame Transformation      &\tt   L'a.b \\
\tt    Spinorial Transformation  &\tt   LS.A'B \\
\hline\end{tabular}

\section{Connection and related objects}
\begin{tabular}{|l|l|}\hline
\tt    Frame Connection     &\tt   omega'a.b\\
\tt    Holonomic Connection &\tt   GAMMA\^m\_n\\
\hline
\multicolumn{2}{|c|}{\tt Spinorial Connection}\\
\tt    Undotted Connection  &\tt   omegau.AB\\
\tt    Dotted Connection    &\tt   omegad.AB\cc\\
\hline
\tt    Riemann Frame Connection     &\tt   romega'a.b\\
\tt    Riemann Holonomic Connection &\tt   RGAMMA\^m\_n\\
\hline
\multicolumn{2}{|c|}{\tt Riemann Spinorial Connection}\\
\tt    Riemann Undotted Connection  &\tt   romegau.AB\\
\tt    Riemann Dotted Connection    &\tt   romegad.AB\cc\\
\hline
\tt    Connection Defect  &\tt    K'a.b\\
\hline\end{tabular}

\section{Torsion}
\begin{tabular}{|l|l|}\hline
\tt    Torsion    &\tt  THETA'a\\
\tt    Contorsion &\tt  KQ'a.b\\
\tt    Torsion Trace 1-form         &\tt   QQ\\
\tt    Antisymmetric Torsion 3-form &\tt  QQA\\
\hline
\multicolumn{2}{|c|}{\tt Spinorial Contorsion}\\
\tt    Undotted Contorsion   &\tt  KU.AB\\
\tt    Dotted Contorsion     &\tt  KD.AB\cc\\
\hline
\multicolumn{2}{|c|}{\tt    Torsion Spinors    }\\
\multicolumn{2}{|c|}{\tt    Torsion Components }\\
\tt    Torsion Trace               &\tt    QT'a\\
\tt    Torsion Pseudo Trace        &\tt    QP'a\\
\tt    Traceless Torsion Spinor    &\tt    QC.ABC.D\cc\\
\hline
\multicolumn{2}{|c|}{\tt    Torsion 2-forms}\\
\tt    Traceless Torsion 2-form     &\tt   THQC'a\\
\tt    Torsion Trace 2-form         &\tt   THQT'a\\
\tt    Antisymmetric Torsion 2-form &\tt   THQA'a\\
\hline
\multicolumn{2}{|c|}{\tt    Undotted Torsion 2-forms}\\
\tt    Undotted Torsion Trace 2-form         &\tt   THQTU'a\\
\tt    Undotted Antisymmetric Torsion 2-form &\tt   THQAU'a\\
\tt    Undotted Traceless Torsion 2-form     &\tt   THQCU'a\\
\hline\end{tabular}


\section{Curvature}

\label{curspincoll}
\begin{tabular}{|l|l|}\hline
\tt    Curvature           &\tt   OMEGA'a.b\\
\hline
\multicolumn{2}{|c|}{\tt    Spinorial Curvature}\\
\tt    Undotted Curvature  &\tt   OMEGAU.AB\\
\tt    Dotted Curvature    &\tt   OMEGAD.AB\cc\\
\hline
\tt    Riemann Tensor      &\tt   RIM'a.b.c.d\\
\tt    Ricci Tensor        &\tt   RIC.a.b\\
\tt    A-Ricci Tensor      &\tt   RICA.a.b\\
\tt    S-Ricci Tensor      &\tt   RICS.a.b\\
\tt    Homothetic Curvature &\tt  OMEGAH\\
\tt    Einstein Tensor      &\tt  GT.a.b\\
\hline
\multicolumn{2}{|c|}{\tt    Curvature Spinors}\\
\multicolumn{2}{|c|}{\tt    Curvature Components}\\
\tt    Weyl Spinor                &\tt  RW.ABCD\\
\tt    Traceless Ricci Spinor     &\tt  RC.AB.CD\cc\\
\tt    Scalar Curvature           &\tt  RR\\
\tt    Ricanti Spinor             &\tt  RA.AB\\
\tt    Traceless Deviation Spinor &\tt  RB.AB.CD\cc\\
\tt    Scalar Deviation           &\tt  RD\\
\hline
\multicolumn{2}{|c|}{\tt Undotted Curvature 2-forms}\\
\tt    Undotted Weyl 2-form                &\tt  OMWU.AB \\
\tt    Undotted Traceless Ricci 2-form     &\tt  OMCU.AB \\
\tt    Undotted Scalar Curvature 2-form    &\tt  OMRU.AB \\
\tt    Undotted Ricanti 2-form             &\tt  OMAU.AB \\
\tt    Undotted Traceless Deviation 2-form &\tt  OMBU.AB \\
\tt    Undotted Scalar Deviation 2-form    &\tt  OMDU.AB \\
\hline
\multicolumn{2}{|c|}{\tt  Curvature 2-forms}\\
\tt    Weyl 2-form                     &\tt    OMW.a.b \\
\tt    Traceless Ricci 2-form          &\tt    OMC.a.b \\
\tt    Scalar Curvature 2-form         &\tt    OMR.a.b \\
\tt    Ricanti 2-form                  &\tt    OMA.a.b \\
\tt    Traceless Deviation 2-form      &\tt    OMB.a.b \\
\tt    Antisymmetric Curvature 2-form  &\tt    OMD.a.b \\
\tt    Homothetic Curvature 2-form     &\tt    OSH.a.b \\
\tt    Antisymmetric S-Ricci 2-form    &\tt  OSA.a.b  \\
\tt    Traceless S-Ricci 2-form        &\tt  OSC.a.b  \\
\tt    Antisymmetric S-Curvature 2-form &\tt  OSV.a.b  \\
\tt    Symmetric S-Curvature 2-form     &\tt  OSU.a.b  \\
\hline
\end{tabular}


\section{Nonmetricity}
\begin{tabular}{|l|l|}\hline
\tt    Nonmetricity        &\tt   N.a.b\\
\tt    Nonmetricity Defect &\tt   KN'a.b\\
\tt    Weyl Vector         &\tt   NNW\\
\tt    Nonmetricity Trace  &\tt   NNT\\
\hline
\multicolumn{2}{|c|}{\tt    Nonmetricity 1-forms}\\
\tt    Symmetric Nonmetricity 1-form     &\tt   NC.a.b\\
\tt    Antisymmetric Nonmetricity 1-form &\tt   NA.a.b\\
\tt    Nonmetricity Trace  1-form        &\tt   NT.a.b\\
\tt    Weyl Nonmetricity 1-form          &\tt   NW.a.b\\
\hline\end{tabular}


\section{EM field}
\begin{tabular}{|l|l|}\hline
\tt    EM Potential    &\tt    A\\
\tt    Current 1-form  &\tt    J\\
\tt    EM Action       &\tt    EMACT\\
\tt    EM 2-form       &\tt    FF\\
\tt    EM Tensor       &\tt    FT.a.b\\
\hline
\multicolumn{2}{|c|}{\tt    Maxwell Equations}\\
\tt    First Maxwell Equation    &\tt    MWFq\\
\tt    Second Maxwell Equation   &\tt    MWSq\\
\hline
\tt    Continuity Equation       &\tt  COq\\
\tt    EM Energy-Momentum Tensor &\tt  TEM.a.b\\
\hline
\multicolumn{2}{|c|}{\tt    EM Scalars}\\
\tt    First EM Scalar         &\tt      SCF\\
\tt    Second EM Scalar        &\tt      SCS\\
\hline
\tt    Selfduality Equation    &\tt    SDq.AB\cc\\
\tt    Complex EM 2-form        &\tt   FFU\\
\tt    Complex Maxwell Equation &\tt   MWUq\\
\tt    Undotted EM Spinor       &\tt   FIU.AB\\
\tt    Complex EM Scalar        &\tt   SCU\\
\tt    EM Energy-Momentum Spinor &\tt  TEMS.AB.CD\cc\\
\hline\end{tabular}

\section{Scalar field}
\begin{tabular}{|l|l|}\hline
\tt    Scalar Equation       &\tt  SCq\\
\tt    Scalar Field          &\tt  FI\\
\tt    Scalar Action         &\tt  SACT\\
\tt    Minimal Scalar Action &\tt  SACTMIN\\
\tt    Minimal Scalar Energy-Momentum Tensor &\tt  TSCLMIN.a.b\\
\hline\end{tabular}


\section{YM field}
\begin{tabular}{|l|l|}\hline
\tt    YM Potential         &\tt  AYM.i9\\
\tt    Structural Constants &\tt  SCONST.i9.j9.k9\\
\tt    YM Action            &\tt  YMACT\\
\tt    YM 2-form          &\tt  FFYM.i9\\
\tt    YM Tensor          &\tt   FTYM.i9.a.b\\
\hline
\multicolumn{2}{|c|}{\tt    YM Equations}\\
\tt    First YM Equation  &\tt   YMFq.i9\\
\tt    Second YM Equation &\tt   YMSq.i9\\
\hline
\tt    YM Energy-Momentum Tensor &\tt  TYM.a.b\\
\hline\end{tabular}

\section{Dirac field}
\begin{tabular}{|l|l|}\hline
\multicolumn{2}{|c|}{\tt    Dirac Spinor}\\
\tt    Phi Spinor   &\tt   PHI.A\\
\tt    Chi Spinor   &\tt   CHI.B\\
\hline
\tt    Dirac Action 4-form &\tt  DACT\\
\tt    Undotted Dirac Spin 3-Form &\tt  SPDIU.AB\\
\tt    Dirac Energy-Momentum Tensor &\tt  TDI.a.b\\
\hline
\multicolumn{2}{|c|}{\tt    Dirac Equation}\\
\tt    Phi Dirac Equation  &\tt   DPq.A\cc\\
\tt    Chi Dirac Equation  &\tt   DCq.A\cc\\
\hline\end{tabular}

\section{Geodesics}
\begin{tabular}{|l|l|}\hline
\tt    Geodesic Equation  &\tt   GEOq\^m\\
\hline\end{tabular}

\section{Null Congruence}
\begin{tabular}{|l|l|}\hline
\tt    Congruence                    &\tt  KV\\
\tt    Null Congruence Condition     &\tt  NCo\\
\tt    Geodesics Congruence Condition&\tt  GCo'a\\
\hline
\multicolumn{2}{|c|}{\tt    Optical Scalars}\\
\tt    Congruence Expansion          &\tt  thetaO\\
\tt    Congruence Squared Rotation   &\tt  omegaSQO\\
\tt    Congruence Squared Shear      &\tt  sigmaSQO\\
\hline\end{tabular}

\section{Kinematics}
\begin{tabular}{|l|l|}\hline
\tt    Velocity Vector  &\tt   UV\\
\tt    Velocity         &\tt   UU'a\\
\tt    Velocity Square  &\tt   USQ\\
\tt    Projector        &\tt   PR'a.b\\
\hline
\multicolumn{2}{|c|}{\tt    Kinematics}\\
\tt    Acceleration     &\tt   accU'a\\
\tt    Vorticity        &\tt   omegaU.a.b\\
\tt    Volume Expansion &\tt   thetaU\\
\tt    Shear            &\tt   sigmaU.a.b\\
\hline\end{tabular}

\section{Ideal and Spin Fluid}
\begin{tabular}{|l|l|}\hline
\tt    Pressure                           &\tt  PRES\\
\tt    Energy Density                     &\tt  ENER\\
\tt    Ideal Fluid Energy-Momentum Tensor &\tt  TIFL.a.b\\
\hline
\tt    Spin Fluid Energy-Momentum Tensor &\tt  TSFL.a.b \\
\tt    Spin Density                      &\tt  SPFLT.a.b \\
\tt    Spin Density 2-form               &\tt  SPFL \\
\tt    Undotted Fluid Spin 3-form        &\tt  SPFLU.AB \\
\tt    Frenkel Condition                 &\tt  FCo \\
\hline\end{tabular}

\section{Total Energy-Momentum and Spin}
\begin{tabular}{|l|l|}\hline
\tt    Total Energy-Momentum Tensor &\tt   TENMOM.a.b\\
\tt    Total Energy-Momentum Spinor &\tt   TENMOMS.AB.CD\cc\\
\tt    Total Energy-Momentum Trace  &\tt   TENMOMT\\
\tt    Total Undotted Spin 3-form   &\tt   SPINU.AB\\
\hline\end{tabular}

\section{Einstein Equations}
\begin{tabular}{|l|l|}\hline
\tt    Einstein Equation           &\tt   EEq.a.b\\
\hline
\multicolumn{2}{|c|}{\tt    Spinor Einstein Equations}\\
\tt    Traceless Einstein Equation &\tt   CEEq.AB.CD\cc\\
\tt    Trace of Einstein Equation  &\tt   TEEq\\
\hline\end{tabular}

\section{Constants}
\begin{tabular}{|l|l|}\hline
\tt    A-Constants &\tt   ACONST.i2\\
\tt    L-Constants &\tt   LCONST.i6\\
\tt    M-Constants &\tt   MCONST.i3\\
\hline\end{tabular}

\section{Gravitational Equations}
\begin{tabular}{|l|l|}\hline
\tt    Action                      &\tt  LACT\\
\tt    Undotted Curvature Momentum &\tt  POMEGAU.AB\\
\tt    Torsion Momentum            &\tt  PTHETA'a\\
\hline
\multicolumn{2}{|c|}{\tt    Gravitational Equations}\\
\tt    Metric Equation             &\tt  METRq.a.b\\
\tt    Torsion Equation            &\tt  TORSq.AB\\
\hline\end{tabular}

\end{center}


\chapter{Standard Synonymy}
\index{Synonymy}

Below we present the default synonymy as it is defined in the
global configuration file. See section \ref{tuning} to find out
how to change the default synonymy or define a new one.

\begin{verbatim}
   Affine Aff
   Anholonomic Nonholonomic AMode ABasis
   Antisymmetric Asy
   Change Transform
   Classify Class
   Components Comp
   Connection Con
   Constants Const Constant
   Coordinates Cord
   Curvature Cur
   Dimension Dim
   Dotted Do
   Equation Equations Eq
   Erase Delete Del
   Evaluate Eval Simplify
   Find F Calculate Calc
   Form Forms
   Functions Fun Function
   Generic Gen
   Gravitational Gravity Gravitation Grav
   Holonomic HMode HBasis
   Inverse Inv
   Load Restore
   Next N
   Normalize Normal
   Object Obj
   Output Out
   Parameter Par
   Rotation Rot
   Scalar Scal
   Show ?
   Signature Sig
   Solutions Solution Sol
   Spinor Spin Spinorial Sp
   standardlisp lisp
   Switch Sw
   Symmetries Sym Symmetric
   Tensor Tensors Tens
   Torsion Tors
   Transformation Trans
   Undotted Un
   Unload Save
   Vector Vec
   Write W
   Zero Nullify
\end{verbatim}


\makeatletter
\if@openright\cleardoublepage\else\clearpage\fi
\makeatother
\thispagestyle{empty}
\def\indexname{INDEX}
\printindex

\end{document}

%========  End of grg32.tex  ==============================================%



GRG for REDUCE
GRG Homepage | GitHub Mirror | SourceHut Mirror | NotABug Mirror | Chisel Mirror | Chisel RSS ]