Basic Commands

This section introduces the basic commands of the Axis scripting language — the language used to interact with Atlas. Axis is an interpreted language with a clean syntax designed for mathematical computation with Lie groups and representations.

Helpful Unix Tools

Before working with Atlas, a few Unix shell tools are useful to know. Atlas sessions can be long; you may want to save output to a file:

Shellbash
$ atlas | tee output.txt   # run atlas and save all output

You can also pipe a script file into Atlas:

Shellbash
$ atlas < myscript.at

Basic Atlas Operations

After starting Atlas you will see the prompt atlas>. You can type expressions directly and Atlas will evaluate them:

Atlas sessionatlas
atlas> 1+1
Value: 2

atlas> 2^10
Value: 1024

atlas> "hello"
Value: "hello"

Use set to bind a value to a name:

Atlas sessionatlas
atlas> set x = 42
x: int

atlas> x * 2
Value: 84

Types

Axis is a strongly typed language. Every expression has a type, and Atlas will tell you the type when you define a variable. The basic types are:

int

An integer. Atlas uses arbitrary-precision integers.

rat

A rational number, represented as a fraction of integers.

bool

A boolean value: true or false.

string

A string of characters, enclosed in double quotes.

vec

A vector of integers, written [a,b,c,...].

mat

A matrix of integers, written as a list of row vectors.

There are also higher-level types for Lie-theoretic objects: LieType, RootDatum, InnerClass, RealForm, KGBElt, Param, and others. These are introduced in later sections.

n-tuples

An n-tuple is an ordered collection of values, possibly of different types. They are written with parentheses:

Atlas sessionatlas
atlas> set p = (3, true, "hello")
p: (int,bool,string)

atlas> let (a,b,c) = p in a
Value: 3

Tuples are used throughout Atlas to return multiple values from functions. For example, many functions return a pair (value, bool) where the boolean indicates success.

Arithmetic

Standard arithmetic operators work as expected on integers and rationals. Integer division uses \ for quotient and % for remainder:

Atlas sessionatlas
atlas> 17 \ 5
Value: 3

atlas> 17 % 5
Value: 2

atlas> 3/4 + 1/6       {rational arithmetic}
Value: 11/12

Note that Atlas uses {...} for inline comments.

Note

The division operator / on two integers produces a rational, not an integer. Use \ for integer (floor) division.