Try our Free Online Math Solver!

Notes about Octave
Octave is a program for linear algebra and certain other
mathe
matical subjects. It resembles a program called MATLAB that is
more powerful and widely used in engineering and science. Octave
is opensource and free; it is easy to obtain and download
. It is available for Mac
intosh, Windows and also Linux. It is also now available through
the network on campus; look in the Student Applications folder on
the desktop, then look in Network Shortcuts.
Octave isn’t userfriendly (it has a command line interface), but it
isn’t hard to use.
When you start up Octave, you will see a window that is something
like:
Near the bottom of the window, you’ll see a “command
prompt,” a
greater than symbol . (This will be preceded by a line of text that
identifies the version of Octave you are using, and gives its location
on your computer.) You can enter a command or other information
into Octave there. For example, try typing in the following:
It will immediately respond with
and give you a new command prompt. You have just entered
in
a matrix, named A, namely . Notice that
entries are
separated by commas, and the rows are separated by semicolons.
You can enter as big a matrix as you wish (as long as each row has
the same number of entries ). Octave shows what you have entered,
so that you can see that you’ve entered in what you meant to.
Now you can do various operations on A. To find its determinant,
enter:
and it will give
We can find the inverse of A. We enter
and it gives
This is of course
Now let’s enter
Now we can perform matrix operations:
The last operation is the transpose of B. You can also
find the
transpose by name, transpose(B).
One more operation to mention: Octave can find the reduced row 
echelon form of a matrix:
One quirk of Octave is that sometimes it gives numbers in
scientific
notation. Often, due to roundoff error, Octave will obtain a very
tiny number instead of exactly 0 for an answer (or an entry in a
matrix). You might see something like:
This is supposed to be det(C) = 0.
What’s happening here is that Octave reports the answer 6.6613 ×
10^{−16} instead of exactly 0. If you enter a small matrix with integer
entries, it’s safe to assume that this tiny number is really supposed
to be 0. (Octave performs arithmetic to 16 significant digits , so
roundoff error is likely to be on the order of 10^{−16}; this is why
you’ll see numbers such as this instead of zero .)
Another thing to consider when using Octave. It gives decimal ex 
pansions, not exact fractions. So Octave will give 0.66667 instead
of . Sometimes, you can recognize the
fractions; sometimes you
cannot so easily.
Here’s an example. First, enter:
We have entered and
. Now if we wish to solve
the system
or AX = b, we can think X = A^{−1}b and tell Octave:
We can’t recognize the actual fractions from these decimal
approx
imations. But here’s a little trick. The determinant of A happens
to be −43 (according to Octave). So multiply the answer by that
number:
So it is now clear that
and . The alternative to this
trick is to find other software that does exact calculations ; programs
known as “computer algebra systems” will give exact
answers. The
catch is that these may or may not have needed linear algebra oper
ations such as rref, and of course you have to find and learn such a
program. (There are expensive and extremely impressive computer
algebra systems, such as Mathematica or Maple ; and there are free,
opensource computer algebra systems, such as Maxima, which are
not as polished and which may a bit hard to use. These programs
will do a lot of calculus and ordinary algebra as well as some lin
ear algebra. They also will draw plots or graphs in two or three
dimensions.)
Note, in this last example, we showed how to solve a system of
linear equations using Octave. But this only works if the coefficient
matrix A is invertible. If A is not invertible, you can enter AX = b
as the augmented matrix [A b ] and tell Octave to find the reduced
rowechelon form of that. You’ll need to finish the problem yourself
(translate back to equation form , solve for the lead variables, set the
free variables equal to parameters t, s; etc).
For those with some background or knowledge in computer pro
gramming, it is worth mentioning that Octave is a full program
ming language. It includes flowcontrol commands such as ‘if’, ‘for’
and ‘while’; stringhandling functions; the ability to define functions
and data structures; and file input and output functions. So if you
have complicated linear algebra problems to solve, Octave can be
a powerful tool. But we will not use any of this in our course! (If
anyone is curious about this, Octave has extensive help files and
online manuals. Unfortunately, these resources are not helpful to
those without a background in computer programming.)
Prev  Next 