Important concepts

In Ket, an equation is treated as a pattern that key presses abstractly reorganize. Commands have been chosen for their concision, generality and to be intuitive rather than to perform a particular algebraic step. It is therefore not immediately clear which commands should be used, or where they should be used. This page will provide some examples of commonly used combinations of commands to introduce some key concepts.

In general, the limiting factor in speed of algebra is in performing each step. In Ket, around ten key presses are sufficient to perform most steps while the equivalent in a text editor will in general take tens or hundreds of key presses and mouse movements. Additionally, the same commands are used in Ket, regardless of the size of the subbranches being manipulated. Here the aim is to avoid retyping anything and instead transforming the information that is already there.

Here a few frequently-used reformatting operations and their associated commands are introduced. Such transformations include taking the inverse of a function, moving variables from one side of an equation to the other, changing the order of operations and factorization.

Simple deleting and pasting parents

Rather than offer single commands to delete and paste, there are two versions of each: A simple version concerned only with the parent argument itself, 'p'; And an alternative version that also concerns the children of the parent being pasted or deleted, 'q'.

The simple parent deletion command is 'dp' which deletes the parent and all other siblings. This stores the parent function in clipboard without any of its children. Similarly, the simple parental pasting command is 'pp' which inserts an additional parent in-between the current argument and its previous parent. Specifically not pasting any children regardless of their being in clipboard. That is, only the function of the branch in clipboard matters.

Removing redundant siblings

It is straightforward to remove a redundant parent and siblings with the 'dp' command. For example
    0+x+0=y
may be simplified by moving to x and then deleting the parent and other children, 'wwdp', to get
    x=y.
Summarising,

  1. Move to x, 'ww';
  2. Delete its parent, 'dp'.
As a result of typing 'wwdp' three redundant arguments have been removed. Note that it is as simple to delete siblings of arbitrary complexity.

Solving a function

The simple delete and paste parent commands may be used together. An example of this is when solving for x in
    sin(x)=y.
Moving to x and deleting the parent, 'wdp', results in
    x=y.
now moving to y and pasting the parent, 'wpp', results in
    x=sin(y).
Now sine can be replaced with its inverse with the inverse command, '~'.
    x=asin(y).
In summary, these commands are

  1. Move to x, 'w';
  2. Delete parent, 'dp';
  3. Move to y, 'w';
  4. Paste parent, 'pp';
  5. Replace the parent with its inverse, '~'.
Therefore, by typing 'wdpwpp~' the argument of a function is solved for.

Alternative deletion and pasting commands

While the simple parent commands ignore or discard siblings, the alternative command directly concerns them. The alternative delete-parent command, 'dq', deletes the current parent, but unlike the simple delete-parent command, it instead deletes the current argument. That is, alternative deletion retains only the current siblings in place of their current parent. Both the parent branch and current argument are stored in clipboard as a branch with a single argument.

The alternative paste parent command, 'pq', adds a new parent branch between the current argument and its previous parent. Just like the simple paste command, the function of this new branch is copied from the branch in clipboard. However, in addition it also appends any children of the branch in clipboard.

Moving variables

The alternative paste parent command allows moving variables from one side of an equation to another. For example, consider moving y from the left hand side of
    x+y=z
to the right hand side of the equation. Moving to y and pressing 'dq' the equation becomes
    x=z
(where clipboard contains +z). Now moving to z and pasting in the same parent-centric manner, the equation now becomes
    x=z+y.
The plus operation can then be replaced with its inverse by pressing the inverse command, '~'.
    x=z-y.
To summarize, the commands were:

  1. Move to y, 'ww';
  2. Alternative delete parent, 'dq';
  3. Move to z, 'w';
  4. Alternative paste parent, 'pq';
  5. Replace the parent with its inverse, '~'.
By using 'wwdqwpq~', a variable was moved to the other side of the equation. Also, this command generalize intuitively to similar operations, so while subtracting a variable is one common action the same sequence of commands work for addition, multiplication and division.

Swapping ancestors

Changing the order of functions

Sometimes it is useful to change the order in which functions are evaluated, i.e. to convert f(g(x)) to g(f(x)). Of particular use is exchanging the order of the parent and grandparent of the current argument. In order to do so, the ancestor rearranging command, 't', command can be used.

For example, to exchange the order in which the sine and arcsine are evaluated in
    sin(asin(x)),
move to x and press the 't' command to get
    asin(sin(x)).
In particular, note that the depth of x remains unaffected.

Changing the order of operations

This idea may be generalized to reorder multiplications and divisions; and to reorder additions and subtractions. For example, the order of operations of x*y/z has multiple representations:
    x*(y/z)=(x*y)/z=(x/z)*y.
To transform between them, the 't' command may be used. This exchanges the order of the two multiplications and the division. It is simpler, however, to consider how it may be used. Moving to the y in the left hand side of the above equation and pressing the 't' command transforms the equation into the middle term. now selecting x and pressing the 't' command again and the right and side is produced.

Factorizing

Perhaps more so than any other command, ancestor rearranging has a greater range of different applications. Another use of this command is in factorization. For example, to take a common factor of x in
    x*y+x*z
the sum of products is converted to a product of x and a sum. First move to the first x, 'w', and press the 't' command. Now the parent (times) and the grandparent (plus) are exchanged to get
    x*(y+x*z).
While the first x factor has been taken outside of the brackets, the second x factor is unaffected. Now the user needs to remove the and its parent. Moving to it, 'ww', and using the alternative delete parent command, 'dq', results in
    x*(y+z).
Summarizing,

  1. Move to the first x, 'w';
  2. Exchange parent and grandparent order, 't';
  3. Move to the second x, 'ww';
  4. Use the alternative delete command, 'dq'.
In total, this is 'wtwwdq'.