- At this stage we need to begin using variables in Calc.
- Since Calc is a stack calculator, it doesn't handle variables like a normal programming language, but you can bind objects to symbols, and then store those symbols, and retrieve them back onto the stack.
- You can store your own objects as follows:
'[[0, 1], [1, 0]]<ret> 1: [ [ 0, 1 ] [ 1, 0 ] ] ss Store: var-sx<ret> '[[0, (0, -1)], [(0, 1), 0]] 1: [ [ 0, (0, -1) ] [ (0, 1), 0 ] ] ss Store: var-sy<ret> '[[1, 0], [0, -1]] ss Store: var-sz<ret>

The prefix`var-`is supplied automatically by Calc. You can back over it, if you don't want to use a`var-`

prefixed canonical name. - If you have typed something wrong, you can edit the
variable by typing
`se`

:se Edit: (default s2) var-

Now type the name of the variable, e.g.,`sy`

, and Calc will put you in the editing buffer that will look as follows:Editing sy. Press M-# M-# or C-c C-c to finish, M-# x to cancel. [ [0, (0, -1)], [(0, 1), 0] ]

Now you can use normal Emacs editing to make changes. - To recall the variable type
`sr`

:sr var-sx 1: [ [ 0, 1 ] [ 1, 0 ] ]

- I will now multiply all those matrices by
`(0,-1)`

and store the results under the same names, so that we'll get 3 new matrices:`var-s1`

,`var-s2`

and`var-s3`

that look as follows:3: [ [ 0, (0, -1) ] [ (0, -1), 0 ] ] ( var-s1 ) 2: [ [ 0, -1 ] [ 1, 0 ] ] ( var-s2 ) 1: [ [ (0, -1), 0 ] [ 0, (0, 1) ] ] ( var-s3 )

- Instead of recalling the variables with
`sr`

you can do as follows:'sx<ret> 1: sx = 1: [ [ 0, 1 ] [ 1, 0 ] ]

- Observe and test yourself the following interesting
properties of matrices
`var-s1`

,`var-s2`

and`var-s3`

:srs1<ret>srs1<ret>* 1: [ [ -1, 0 ] [ 0, -1 ] ] srs2<ret>srs2<ret>* 1: [ [ -1, 0 ] [ 0, -1 ] ] srs3<ret>srs3<ret>* 1: [ [ -1, 0 ] [ 0, -1 ] ] srs1<ret>srs2<ret>*srs3<ret>* 1: [ [ -1, 0 ] [ 0, -1 ] ] srs1<ret>srs2<ret>* 1: [ [ (0, -1), 0 ] [ 0, (0, 1) ] ] ( = var-s3 ) srs2<ret>srs3<ret>* 1: [ [ 0, (0, -1) ] [ (0, -1), 0 ] ] ( = var-s1 ) srs3<ret>srs1<ret>* 1: [ [ 0, -1 ] [ 1, 0 ] ] ( = var-s2 )

- Translating the above results to a normal mathematical
notation yields:

The*i*,*j*, and*k*shown in the above equations are quaternion ``imaginary numbers''.What we have just demonstrated is that there is an isomorphism between quaternions and Pauli matrices, because that is what , , and are.

- Quantum physicists will be right at home when they recognise
that

SU(2) is two-to-one homomorphic with SO(3), which is a group of orthogonal matrices with real coefficients and determinant 1. In other words SO(3) is a group of rotations. There is another group that is also related to quaternions and to Pauli matrices, that is called SL(2,C), i.e., a group of matrices with complex coefficients and determinant 1. There is a mapping between Lorentz group and SL(2,C) that is defined as follows:

where is the identity matrix. This mapping preserves the Minkowki metric. SL(2,C) is two-to-one homomorphic with the Lorentz group. - Hamilton , who invented quaternions was just a short step away from having discovered Special Relativity a century before Einstein. Mathematics of quaternions alone would have unfolded the whole new physics, sic!

- Once you have a matrix on the stack, say,
`s_3`

, you can extract any of its rows as follows:sr var-s3 1: [ [ (0, -1), 0 ] [ 0, (0, 1) ] ] vr Row number: 1 1: [(0, -1), 0]

Calc asks about the row number in the minibuffer. - To get hold of any particular element in that row,
use the following command:
C-u1vr 1: (0, -1)

where`C-u`

is Control-u followed by an index of a row element you're after, followed by`vr`

. This time no questions are asked in the minibuffer. - You can also extract a range of items from an array
with the
`C-u..vr`

command. For example'[1,2,3,4,5,6,7,8] 1: [1, 2, 3, 4, 5, 6, 7, 8] '[2..6] 1: [2 .. 6] C-uvr 1: [2, 3, 4, 5, 6] 3<ret>C-uvr 1: 4

As you see you can place an index for the`C-u`

switch either before it, on the stack, or after it, when typing the`C-u..vr`

command. - You can also use a subscript notation in algebraic formulas,
e.g.,
'[[0, -1], [1, 0]]_1_2 1: -1

- In order to extract a column of a matrix instead of extracting
its row, use the
`vc`

command:sr var-s3 1: [ [ (0, -1), 0 ] [ 0, (0, 1) ] ] vc Column number: 2 1: [0, (0, 1)] vc Column number: 1 1: 0

- As you see, instead of using
`vr`

followed by`C-u..vr`

you can use`vr`

followed by`vc`

to the same effect.

- There are many other wondrous things you can do with vectors and matrices that we'll skip in order to get to vector and matrix algebra as soon as possible.
- Here I'll only draw your attention to matrix transpose.
The command is
`vt`

:'[[1,2,3][4,5,6]] 1: [ [ 1, 2, 3 ] [ 4, 5, 6 ] ] vt 1: [ [ 1, 4 ] [ 2, 5 ] [ 3, 6 ] ]