LWN.net Logo

Numerical computations with Scilab 5.2

January 27, 2010

This article was contributed by Koen Vervloesem

At the end of 2009, the Scilab Consortium released version 5.2.0 of the numerical computation tool Scilab. It consists of a toolbox for doing numerical computations for science and engineering applications. Scilab's underlying programming language has a syntax similar to, and mostly compatible with, the popular proprietary software MATLAB.

Scilab has a source code translator to assist the user with converting code from MATLAB. That's a big convenience, because many engineering students have learned MATLAB at the university, and it's also a de facto standard in industry. A lot of source code written for MATLAB can also be run on Scilab.

Hands on with Scilab

Working with Scilab is rather straightforward. When the application starts, it shows a console window where the user enters commands. Most of these commands are in the form of mathematical expressions with objects like polynomials or matrices, and after entering the command Scilab computes the result of the expression and shows it on the console. The output is in text mode, even numerical expressions with fractions and powers, which is surprisingly easy to read. So it's like a shell in an operating system, but with mathematical expressions instead of operating system commands.

[Scilab subplot]

There are also plotting commands, which open a new graphic window and plot a mathematical function in it. Users can save the resulting plot to reload it later in Scilab, copy the image to the clipboard or export it to one of a couple of bitmap and vector file formats. The image can also be zoomed or rotated in 2D or 3D.

Scilab helps the uninitiated a lot by showing extensive information about all available commands in the Help Browser. Each command has an associated documentation page that is viewable in this browser, with information about the parameters, a description of what the command does and examples that can be entered in the Scilab console. When the user installs an external toolbox, its documentation is also integrated into the Help Browser. Another great way to explore the possibilities of Scilab are the demos. They are subdivided into various categories and users can even take a peek at their source code. So while Scilab isn't exactly easy to learn, users can learn a lot by looking at the demos' source code and the examples in the Help Browser.

Most of the advanced features are split in a large number of "toolboxes" (modules) for specific tasks. Among the possibilities are linear algebra, working with sparse matrices, polynomials and rational functions, interpolation and approximation, number theory, 2D and 3D graphics and animation, signal processing, Fast Fourier Transforms, wavelets, manipulating graphs and networks, statistics, artificial neural networks, econometrics, and so on. There are also interfaces with programming languages and environments like Fortran, Tcl/Tk, C, C++, Java, and LabVIEW. There is also a package that plugs into the proprietary computer algebra system Maple for Scilab code generation, and there is a toolbox that translates Scilab code into standalone C code.

[Scilab Lena Wavelet]

Scilab saved your author several times when writing articles about computer science. For example, once he undertook the daunting task of explaining wavelet transformations and their applications to image processing. Because a picture is worth a thousand words, he thought it would be nice to visualize this. But how? As an engineering student he had an educational license for MATLAB, but those days were gone and paying thousands of dollars for software is not an option for a freelance journalist. After much searching, adapting scripts and experimenting, your author managed to visualize the wavelet transformations with the Scilab Wavelet Toolbox and a Scilab script of thirty lines. That's the power of Scilab: it gives free access to scientific computations that would cost a great deal of money to do using other software.

Download

Prior to version 5, Scilab had a non-free license: although the project gave users access to its source code, the license restricted distribution of modified versions to non-commercial purposes. Beginning with version 5, the developers distribute Scilab under the CeCILL license ("CEA CNRS INRIA Logiciel Libre"), jointly developed by a number of French agencies to comply with both international and French law. CeCILL is not OSI-approved, but it follows the principles of GPL and it is GPL-compatible.

Current releases of mainstream Linux distributions don't have Scilab 5.2 yet in their repositories, so for now users have to download the package from Scilab's web site. They can download the source and try to build Scilab 5.2 themselves, or they can download the binary version for their platform (which includes a lot of the third-party dependencies) and install it. The website distributes x86 and x86_84 versions for Linux and Windows and a dmg installer for Mac OS X 10.5/10.6 (on Intel).

It may take some time before Scilab 5.2 becomes available in distributions' repositories. For example, Fedora is working on it, but there are a lot of incomplete dependencies and several packages for optional functionality are not yet available.

A better user experience

[Scilab atoms]

New features in Scilab 5.2 are mostly focused on a better user experience. For example, while previous releases required the user to install external modules manually, the latest release comes with a management tool called ATOMS (AutomaTic mOdules Management for Scilab). This tool allows the user to browse Scilab or third-party repositories and download and install external modules from a graphical window (although the commands in the Scilab console are still available). It also facilitates updating existing modules and manages dependencies. Essentially, ATOMS functions as a package manager for Scilab modules. It can also automatically load installed modules when Scilab starts.

By default ATOMS lists a fairly limited set of modules. More are listed on the ATOMS Portal, a new web site that hosts external modules and allows developers to upload their own modules. Unfortunately, even the ATOMS Portal lacks a lot of popular modules like the Scilab Image Processing Toolbox and the Scilab Wavelet Toolbox.

Another addition to Scilab's user experience is a new Java-based text editor that integrates into Scilab. Some of the features are syntax coloring, automatic indentation, line numbering, comment/uncomment of blocks, and getting help on a selected line. The new editor replaces the previous one, Scipad, which remains available through ATOMS.

A third new feature is the ability to annotate graphics with MathML and LaTeX text. This is available in all places where text can be set in a graphic, such as the label and title. This makes it possible to include mathematical equations, greek names of variables, matrices and other symbols. There's also a new function prettyprint that can represent a Scilab variable as a LaTex or MathML expression.

Scilab 5.2 also replaces its modeling tool Scicos by Xcos, which is based on Scicos 4.3, has a new JGraphX-based user interface and promises a roadmap that is synchronized with Scilab. Xcos is a dynamic systems modeler and simulator, which can be used for modeling mechanical systems like accelerating vehicles, hydraulic systems like water tanks and electrical systems like amplifiers and logic gates. The release in Scilab 5.2 provides a new block diagrams editor and finally allows the user to edit several diagrams at the same time. Drag and drop from a palette to a diagram and between two diagrams now also works.

Conclusion

The focus on better user experience notwithstanding, Scilab's interface still has some rough edges and peculiarities. For example, the windows have their own close button inside the operating system's window (which also has, in most cases, a close button). The graphs have redraw issues when Compiz is activated. Moreover, error messages are sparse, somewhat hidden, and sometimes in broken English. So it could still use some polishing, but it gets the job done, which is the most important factor. Scilab is a powerful free alternative to pricey commercial tools like MATLAB. Anyone who regularly needs scientific computations or plotting capabilities should take a look at Scilab.


(Log in to post comments)

Numerical computations with Scilab 5.2

Posted Jan 28, 2010 7:10 UTC (Thu) by boudewijn (subscriber, #14185) [Link]

Is that article "explaining wavelet transformations and their applications
to image processing" available somewhere? I'd be interested to read it
:-).

Numerical computations with Scilab 5.2

Posted Jan 28, 2010 11:46 UTC (Thu) by koenvervloesem (guest, #56573) [Link]

If you can read Dutch (what your name suggests), I can send you a copy of the article. Just send me an email (firstname@surname.eu).

Numerical computations with Scilab 5.2

Posted Nov 11, 2010 7:51 UTC (Thu) by biplabr (guest, #71171) [Link]

Can anyone help me in doing wavelet transform in scilab? I need some step-by-step guide. I have installed both wavelab and scilab wavelet toolbox without knowing 1. which one is better, and 2. How to use them. None of them is well-documented.

I am new to both scilab and signal analysis.

Please help.

Regards

Numerical computations with Scilab 5.2

Posted Jan 28, 2010 11:01 UTC (Thu) by nijhof (subscriber, #4034) [Link]

It's in Debian unstable already!

(I haven't tried it, yet, though)

Numerical computations with Scilab 5.2

Posted Jan 28, 2010 21:39 UTC (Thu) by bollin (subscriber, #5582) [Link]

Definitely very good software. Thanks for the article.

I've been pushing scilab into Debian since 2001 and I am happy that scilab is still there and it is developed by Sylvestre, who is a more skilled developer.

Numerical computations with Scilab 5.2

Posted Jan 28, 2010 11:21 UTC (Thu) by jmspeex (subscriber, #51639) [Link]

I tried scilab at some point (>10 years ago) and it was OK, but I actually preferred Octave, which is mostly compatible with Octave. I still use Octave a lot, even when I have Matlab available because it's so much more lightweight than Matlab.

Numerical computations with Scilab 5.2

Posted Feb 4, 2010 3:27 UTC (Thu) by roelofs (guest, #2599) [Link]

... Octave, which is mostly compatible with Octave.

"...with Matlab"?

Greg

Numerical computations with Scilab 5.2

Posted Mar 3, 2010 19:40 UTC (Wed) by oak (guest, #2786) [Link]

Back then I was using (a bit) Euler, but that doesn't seem to have been
updated in recent years. Last update was Gtk1->Gtk2 switch. How Euler
stacks against Octave and Scilab?

Numerical computations with Scilab 5.2

Posted Jan 28, 2010 14:08 UTC (Thu) by sylvestre (subscriber, #57054) [Link]

"The windows have their own close button inside the operating system's window (which also has, in most cases, a close button)."
It is because Scilab has a docking system. The close button allows the close of a docked window.

Scilab alternatives

Posted Jan 28, 2010 17:21 UTC (Thu) by andrel (subscriber, #5166) [Link]

Those looking to stick with Matlab syntax should check out Octave and Freemat.

I've switched away from Matlab to a mix of ipython and R. I find both keep the good parts of Matlab syntax (operating on vectors), but with richer data structures.

Scilab alternatives

Posted Jan 28, 2010 20:23 UTC (Thu) by tnoo (subscriber, #20427) [Link]

or the mainstream Python combo:
- ipython
- scipy / numpy
- matplotlib
- mayavi

which provides about everything the other alternatives do, but has all the
conveniences of Python (very clean programming language). And of course
all the Python bindings to about every software out right at your
fingertips.

Scilab alternatives

Posted Jan 29, 2010 1:32 UTC (Fri) by njs (guest, #40338) [Link]

Those are all great, but like the poster above, I still use R -- there's just nothing that matches its breadth of statistical routines.

But I use R as a python library -- http://bitbucket.org/njs/rnumpy/wiki/IPython_integration

Copyright © 2010, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds