Accompanying this course is a package which is designed to help you with elementary row operations row reducing matrices, and other operations. The package is written in Julia, which is a new (2012) and beautiful scientific programming language which combines speed with convenience and expressiveness. You can use it as a calculation tool without aiming to develop any programming skills, but any skills you do develop along the way are likely to be valuable to you in the future.

My intention is that you use this package to reduce the matrix calculation workload. There will be far more matrices to row reduce in this course than you need to develop that skill, and being able to quickly have arithmetic performed for you will allow you to focus on higher order concepts.

This package provides advantages over other systems. Chiefly, you have direct access to the package developer, and the tools made available to you are tailored to your use case. When you need technical assistance, I will be able to efficiently help you out. Advantages over calculators include improved input and display, as well as support for precision arithmetic (i.e., fractions instead of decimals). Finally, Julia's syntax and programming style are very similar to those of many other popular scientific computing languages, like Python and MATLAB.

The first step is to install the package. Copy-paste the next command, put it into a cell, and do shift+enter.

In [1]:

```
Pkg.clone("git://github.com/sswatson/IntroLinearAlgebra.jl.git")
```

*comment*, i.e., it isn't run and is just there to help you understand what's going on):

In [2]:

```
Pkg.update("IntroLinearAlgebra") # Update just this package
#Pkg.update() # Update all packages
```

In [3]:

```
using IntroLinearAlgebra
```

`2//7`

. Otherwise, the computer uses floating point encoding that it displays as a decimal (like you're used to with a calculator).

In [4]:

```
M = [1 2 3 4; 5 6 7 8; 9//2 10//2 11//2 12//2]
```

Out[4]:

We can row reduce with the function `rref`

.

In [5]:

```
rref(M)
```

Out[5]:

If we want to do particular row operations, we can do that with the functions `rowswitch`

, `rowscale`

, and `rowadd`

. If we forget how the functions work, we can run `?rowadd`

(for example) to get the documentation.

In [6]:

```
?rowadd
```

Out[6]:

Here are some random row operations.

In [7]:

```
# switch the first and second row, and save the new matrix to the name M
M = rowswitch(M,1,2)
# scale the third row by 3//2 and save
M = rowswitch(M,3,2)
# Replace the **third** row with itself plus the **first** row times -1//5
M = rowadd(M,3,1,-1//5)
```

Out[7]:

If you want to drop particular columns, you can do that by *indexing* the matrix. The way it works is that you do

```
M[row_instruction,column_instruction]
```

where the two instructions can be `:`

, which makes take all of them, or just a range like `2:7`

which means take the second through the seventh and drop the rest, or a list of true/false values, like `[true, true, false, true, false, true]`

that says exactly which ones you want to keep. Here's an example:

In [8]:

```
A = M[:,[true,false,true,true]] # drop second column
```

Out[8]:

In [9]:

```
B = M[2:3,2:4]
```

Out[9]:

If we want to use variables as well as numbers, we need another package.

In [10]:

```
Pkg.add("SymPy")
```

`x`

, `y`

and `z`

like symbols.

In [11]:

```
using SymPy
@vars x y z
```

Out[11]:

In [12]:

```
M = [1 2 3 x; 4 5 6 y]
```

Out[12]:

In [13]:

```
rref(M)
```

Out[13]:

`Interact`

package. It's preinstalled on JuliaBox; if you're using a local installation you'd want to run `Pkg.add("Interact")`

.

In [14]:

```
using Interact
```

In [15]:

```
steps = rref([1 2 3 4; 5 6 7 8];showsteps=true);
```

In [16]:

```
@manipulate for i=1:length(steps)
steps[i]
end
```

Out[16]:

Let's make a movie to visualize how the matrix [0 1; -2 0] acts on the plane. We need the Graphics2D package.

In [17]:

```
Pkg.clone("git://github.com/sswatson/Graphics2D.jl.git")
```

In [18]:

```
using IntroLinearAlgebra
using Interact
movie = transformation_movie([0 1; -2 0]);
@manipulate for i=1:length(movie)
movie[i]
end
```

Out[18]:

In [19]:

```
A = [1 5; 6 2]
```

Out[19]:

In [20]:

```
eigenspaces(A)
```

Out[20]:

In [ ]:

```
```