Introduction

RLaB  brings the power of stable matrix maths tools plus a stable data plotting facility together in a form that is freely available and ready to be compiled and used on a variety of common computer systems. RLaB  allows you to experiment with complex matrix maths in an interactive environment. Because you enter commands at a high (mathematical) level, you can concentrate on figuring out your solution and hopefully avoid becoming bogged down in low level implementation details. By minimising the effort required to implement algorithms, it is hoped that you will be more willing to discard old programs when confronted by better algorithms that warrant use.

RLaB  uses a structured language1 which will be familiar to users of C and also the Wirth-inspired languages such as Pascal and Modula. An RLaB  program is a file containing a sequence of commands or instructions that you could also enter from your terminal—these instructions might perform a calculation and assign the result to a variable, or call a function which returns a result which you display on your terminal, and so on. Functions can be either built-in or user-defined. In fact, the only form of ``subprogram'' in RLaB  is the function and, just like in C, a function returns a single item as its answer. Data storage declared in the main routine of your program is stored on a global symbol table, and is available to all of your subprogram functions. By default, data used within functions is local to the function. Such local function storage exists only for the duration of the function call, in a way similar to variables declared locally within Pascal procedures. Comments can be appended to any line in your program by using a special symbol at the start of the comment—this is similar to Fortran and C++, and avoids the possible pitfall of ``run away'' comments which might be familiar to Pascal users. Overall, the language syntax is perhaps closest to C but if you have ever programmed in C or Pascal, you will soon be at ease with RLaB .

RLaB  features strongly typed objects but with the emphasis on usefulness, not on pedantics. In RLaB   we talk about the class of an object and the available classes include numeric, string, function, and list. The first class of object, numeric, encompasses numeric scalars, vectors, and matrices, and should be familiar to the matrix maths user. The remaining classes borrow concepts, and implementation details from other languages such as C.

It is worth noting that a function can be thought of as just another object—this means that when you come to write your own functions that use input parameters, you will enjoy the flexibility of being able to pass in other functions as well as data as input to your function. Another feature of functions as implemented in RLaB  is that they can call themselves—anyone who has written a program to calculate factorials will appreciate the elegance that recursion can bring to some programming solutions.

Having whetted your appetite, this primer aims to get you started with RLaB  as both an interactive tool and as a programming language. The ideal approach is for you to read (or re-read) this document with an RLaB  session staring up at you. After showing you how to run RLaB  and get on-line help, we describe data types before moving back to a ``hands on'' description of basic operations. Program structure is then described and you will see how to write your own functions. As RLaB  comes with quite a few handy functions already built-in, we give examples of their use including the plot function at which point we hope you will be able to start using RLaB  to develop your own programs.