Getting started

Modelling an equation

Ket maintains a list of equations that summarize the algebraic steps as one or more initial equations are transformed into one or more results. Each equation is modelled as a collection of symbols that are connected together in some way. This collection is a `tree' of arguments, each subbranch of which is a function of functions and arguments.

The arguments of an equation can either be a token such as a number or variable, or as a branch. Tokens can be variables or values and tokens are common functions such as sin as well as standard operations such as addition.

Tokens include integers, e.g. 0, 1, 2, and real numbers, e.g. 13.5, 0.0, and variables. Variables consist either of a string, a symbol or as a combination thereof. For example, Greek letters are spelled in English (e.g. α is written as "&alpha"). Subscripts in variable names are denoted with an underscore '_', e.g. "A_min" corresponds to Amin.

All functions have a string name and can contains zero or more arguments. Some specific functions such as plus are displayed symbolically, and others highlight incorrect numbers of arguments. Functions are generally written as
     <function name>(<argument>, <argument>, <argument>)
where common function names include:
FunctionExample
sin sin(3.14)
cos cos(x)
tan tan(y/x)
exp exp(1.0)
ln ln(x)
log log(a,b)=log(b)/log(a)
sqrt sqrt(4)=2
power power(2,3)=8
fraction fraction(1,2)=1//2
times times(3,2)=3*2
minus minus(1)=-1
minus(5,2)=5-2
minus(1,2,3,4,5)=1-2-3-4-5
plus plus(3,2,1)
equals equals(a,b) is equivalent to a=b

Movement commands

Movement commands are relative to the currently selected argument that is highlighted in red. Movement is performed by a group of right hand keys that can move to the current argument's parent, siblings or children. Movement commands are used very frequently.

CommandDescription
'j' Move down to the next equation.
'k' Move up to the previous equation.
'h' Move the selection from the current argument to that of the argument to its left.
'l' Move to the next sibling to the right of the currently selected argument.
'<Space>' Move from the current argument to its parent.
'i' Move to the leftmost child of the current argument.
'o' Move to the rightmost child of the current argument.

Adding to the list of equations

Equations are added with the 'ae' command and are entered explicitly. Alternatively, an equation may be entered in parts, relative to the currently selected argument.

Because of the number of different ways, the add command consists of two parts
     'a' + <direction>
Some directions include: equation (e), right-sibling (l) or right-child (o). For example, a new branch may be added with the 'ab' command.

CommandDescription
'ae' Add a new equation after the current equation.
'al' Add a new right sibling.
'ao' Append a new child to the right of the current argument.
'a<Space>'Add an intermediate parent function.

Modifying

In order to change the current function, move to it and press the 's' key. Alternatively, the entire sub-branch may be replaced with the 'r' command.

Reorganizing

It is often useful to move the currently selected argument relatively. This is analogous to the relative movement commands (see above), but changing the position of the current argument rather than changing which argument is selected. Reorganizing commands are therefore capital letter versions of those movement commands.

For example, just as 'l' moves to the next sibling, 'L' moves the current argument to the right of the next sibling. If the current argument is the rightmost in the list of equations, then it is wraps around and is moved to the first argument in the list. The 'H' command acts in the same way, but moving one argument to the left, or wrapping around to the last argument. Similarly, the 'K' and 'J' commands move the current equation up and down the list of equations, respectively.

The rightmost child reorganization command, 'O', is more complicated. If the sibling to its right is a branch, then the argument will be moved inside as its first child. If the sibling to the right isn't a branch then this acts as the 'L' command. However, if there is no right sibling then the argument is moved outside of its parent. If this argument is to be moved to the root of the equation, it is removed from the equation and added below as a new equation. The leftmost child movement command, 'I', does the same, but moves to the left and moves arguments above the current equation. In this way, arguments may be moved 'through' an equations.

CommandDescription
'J' Move the current equation down one equation.
'K' Move the current equation up one equation.
'H' Move the current argument to the left of its siblings.
'L' Move the current argument to the right of its next sibling.
'I' Move the current argument rightwards inside its next branch, or to the right of the next token, or to the right of its parent.
'O' Move the current argument leftwards inside its previous branch, or to the left of its next token, or to the left of its parent.

Deletion

Equations or sub-branches thereof may be deleted by moving to them and pushing the 'x' key. Deleting the root of the tree deletes the entire equation.

Undoing

As an equation is transformed, it is convenient to show working, i.e. to keep a record of the various steps. To take a snapshot of the current equation state, simply press <Enter> to duplicate the current equation.

In the case that a mistake is made, such as typing the wrong command, simply press 'u' to undo the previous command and the mistake will be undone.

Clipboard

In Ket, copying is referred to as yanking, and can be performed by moving to the sub-branch to copy and pressing the 'y' key. Once a sub-branch is stored in clipboard, pasting can be performed with the paste-branch command, 'pb'.

Display options

The most important display options move the list of visible equations up by one, '<Ctrl y>', or down by one, '<Ctrl e>'.

Additionally, it can be useful to only view the current equation, to switch between the single equation view and the list view, use the 'e' command.