Overview
Comment:Create `doc` subdirectory, organize documentation.

Move: grg32.tex -> doc/grg32.tex - Manual (LaTeX)
Add: doc/grg32.lyx - LyX conversion of grg32.tex
Add: doc/grg32.pdf - PDF rendering of grg32.tex

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 60be935dab12de9094951d63e908e849d6472d7461b2196c00940a477f511419
User & Date: jeff@gridfinity.com on 2021-03-01 03:53:26
Other Links: branch diff | manifest | tags
Context
2021-03-01
03:57:54
Update README.md: Provide links to documentation. check-in: de20f2ba36 user: jeff@gridfinity.com tags: origin/master, trunk
03:53:26
Create `doc` subdirectory, organize documentation. check-in: 60be935dab user: jeff@gridfinity.com tags: origin/master, trunk
03:45:47
Update README.md: Expand Markdown formatting. check-in: 4667a4b396 user: jeff@gridfinity.com tags: origin/master, trunk
Changes

Added doc/grg32.lyx version [3db6322525].

more than 10,000 changes

Added doc/grg32.pdf version [90c820f507].

cannot compute difference between binary files

Added doc/grg32.tex version [b22c15a345].















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
%==========================================================================%
%  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  ==============================================%

Deleted grg32.tex version [b22c15a345].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
%==========================================================================%
%  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 ]