Getting Started with Scilab

Introducing one of the larger scientific lab packages for Linux.

Scilab is meant to be an overall package for numerical science, along the lines of Maple, Matlab or Mathematica. Although a lot of built-in functionality exists for all sorts of scientific computations, Scilab also includes its own programming language, which allows you to use that functionality to its utmost. If you prefer, you instead can use this language to extend Scilab's functionality into completely new areas of research. Some of the functionality includes 2D and 3D visualization and optimization tools, as well as statistical functions. Also included in Scilab is Xcos, an editor for designing dynamical systems models.

Several options exist for installing Scilab on your system. Most package management systems should have one or more packages available for Scilab, which also will install several support packages. Or, you simply can download and install a tarball that contains everything you need to be able to run Scilab on your system.

Once it's installed, start the GUI version of Scilab with the scilab command. If you installed Scilab via tarball, this command will be located in the bin subdirectory where you unpacked the tarball.

When it first starts, you should see a full workspace created for your project.

Figure 1. When you first start Scilab, you'll see an empty workspace ready for you to start a new project.

On the left-hand side is a file browser where you can see data files and Scilab scripts. The right-hand side has several panes. The top pane is a variable browser, where you can see what currently exists within the workspace. The middle pane contains a list of commands within that workspace, and the bottom pane has a news feed of Scilab-related news. The center of the workspace is the actual Scilab console where you can interact with the execution engine.

Let's start with some basic mathematics—for example, division:


--> 23/7
 ans  =

   3.2857143

As you can see, the command prompt is -->, where you enter the next command to the execution engine. In the variable browser, you can see a new variable named ans that contains the results of the calculation.

Along with basic arithmetic, there is also a number of built-in functions. One thing to be aware of is that these function names are case-sensitive. For example, the statement sqrt(9) gives the answer of 3, whereas the statement SQRT(9) returns an error.

There also are built-in constants for numbers like e or pi. You can use them in statements, like this command to find the sine of pi/2: