## Week 0 Lectures: Quick Intros to Functions & Fields

The first set of lectures (Week 0, since as we know python list are indexed starting with 0!) has little to do with actual linear algebra, but instead gives you quick intros to two central concepts: functions and fields:

The first lectures (The Function) review some basic notation, terminology and concepts that you’ll be using throughout the course, including notation for sets and functions.  The highlight of this part is the concept of invertible function.

After that, we’ll look at The Field. A field is a collection of values with a plus operation and a times operation. You will already be familiar with the field of real numbers but perhaps not with the field of complex numbers or the field GF(2), which consist just of zero and one. We will discuss these fields and give examples of applications.

Functions you are hopefully already familiar with, from precalculus, calculus, etc. Professor Klein’s lectures go over the concepts and terminology fairly quickly, so you may need to pause as you watch, and perhaps consult some other material. If you have your textbook from when you took precalc or calc, take a look at that section(s) in there on functions. Or you can take a look at:

Fields you may be less familiar with. Actually, as noted above, you’ve worked with the canonical example of a field in your previous math classes–the real numbers. But to illustrate the general concept, Professor Klein introduces two other fields in his lectures: the complex numbers and the Galois Field with two elements, abbreviated GF(2).

The important feature of fields is that they include both an addition and multiplication–these are the two operations needed to carry out linear algebra!  Soon we’ll go over vectors and matrices “over” any given field (meaning the entries in the vector or matrix are taken from the given field).

(Btw, GF(2) is named for the famous algebraist Evariste Galois–there’s a whole branch of abstract algebra called Galois theory, which he developed during his short life. In fact, finite fields in general are called Galois fields in his honor.)

For more on the complex numbers and GF(2), see:

## How To Get Started: Python Programming Labs

So if you’re ready to get started “coding the matrix” here’s what you should do first:

• Spend a few minutes skimming through the course overview, and spend 20 minutes watching Professor Klein’s 2-part Course Introduction videos.
• Go to the course syllabus and jump down to Week 0. There are a handful of video lectures introducing some of the math, but before that get started with the two programming labs right away.
• To do the programming labs, you’ll need to get set up with Python–in particular Python 3.3.2.  This may already by installed on the computer you’re using (you can check by typing “python -V” or “python3 -V” at the command line). My machine only had an older version, so I had to download and install Python 3.3.2, which was easy enough.  You’ll also need to use a text editor to create and edit Python scripts. See this “Software Environment” page for more instructions.
• The first two programming labs–the Python Lab and the Inverse Index Lab–are designed to get you up to speed on Python, and in particular on some aspects of the language that will be used later in the course to implement linear algebra concepts. Follow the instructions on each page: download and unzip the zip files, and put the resulting files in a “matrix” directory on your computer.

I suggest you have (at least) 3 windows open as you work through the programming assignments:

1. The pdf file for the assignment, which goes through the material and contains the programming tasks for the assignment. As you read through this, experiment with python commands inside..
2. A terminal window running the Python “REPL” (the “read-eval-print-loop”, which you enter by running “python3” at the command line–make sure you’re in your “matrix” directory when you do so). As you work through each programming task and are satisfied that you’ve written code that carries out the task, copy and paste that code into..
3. The template file .py provided for each assignment ( python_lab.py  for the Python lab), i.e., have that file open in a text editor.  You submit your code–and immediately find out whether you’re completed the tasks correctly–as follows: “submit your solution by opening a console window, navigating using cd to the matrix folder, and entering the command python3 submit_python_lab.py. You will need a one-time password to submit this assignment. It’s located on this page.”  Moreover, “You can use the submit command to submit solutions for as many tasks as you like at one time. Enter the numbers of the tasks (called parts), separated by commas. You can also enter a range of numbers such as 3-10.”

In addition to the instructions on each assignment page, see also this short video tutorial on “How to submit assignments.”

What I’ve found useful is to do complete just one or two tasks and then submit them by running the submit script, so as to get immediate feedback about whether I’ve completed those tasks correctly, before moving on through the lab. That way you can be sure you understand each concept before moving on to the next one–plus you also get the immediate satisfaction of seeing your score grow on your Assignments page.

So go ahead and jump in to some Python. Depending on how much programming experience you have (and especially if you have any exposure to Python), the first Python Lab should go fairly quickly.

Even if you’re a programming newbie, the lab should be doable. It ramps up from very basic concepts (arithmetic operators and expressions, strings) through various Python data structures (sets, lists, tuples, dictionaries). The key concept is creating new data structures via what are called comprehensions.  (If you’re interested in programming languages, such comprehensions are one way in which Python incorporates aspects of functional programming.)

Here are a few additional Python resources that might be useful: