New Scientific Features in 2011

The goal of this page is to summarize the new scientific features of Scilab and its environment during the year 2011.

During the year 2011, the following versions of Scilab were released :

In brief, the following is a list of the new or updated scientific features in 2011 :

New Computational Features in Scilab 5.3.1

These informations are extracted from the CHANGES.

The following is a more detailed list of changes for the Karmakar function:

The following is an example of the karmarkar function, extracted from the help. We solve a linear program with linear inequalities.

c = [-20 -24]';
A = [
3 6
4 2
b = [60 32]';

The previous script produces the following output.

 xopt  =

6th of January 2011: scibench

The goal of this project is to provide a collection of benchmark scripts to measure the performance of Scilab.

This module provides the following functions.

The scibench project is available on ATOMS:

and is developped on the Forge :

The following is an example of the scibench_matmul function.

scibench_matmul ( );

The previous script produces the following output.

-->scibench_matmul ( );
Run #1: n=     1, T=0.010 (s), Mflops=     0
Run #2: n=    18, T=0.002 (s), Mflops=     5
Run #3: n=    40, T=0.010 (s), Mflops=    12
Run #4: n=    48, T=0.012 (s), Mflops=    18
Run #5: n=    58, T=0.002 (s), Mflops=   195
Run #6: n=    70, T=0.014 (s), Mflops=    49
Run #7: n=    84, T=0.004 (s), Mflops=   296
Run #8: n=   101, T=0.007 (s), Mflops=   294
Run #9: n=   122, T=0.003 (s), Mflops=  1210
Run #10: n=   147, T=0.004 (s), Mflops=  1588
Run #11: n=   177, T=0.005 (s), Mflops=  2218
Run #12: n=   213, T=0.014 (s), Mflops=  1380
Run #13: n=   256, T=0.013 (s), Mflops=  2581
Run #14: n=   308, T=0.013 (s), Mflops=  4495
Run #15: n=   370, T=0.015 (s), Mflops=  6753
Run #16: n=   444, T=0.031 (s), Mflops=  5646
Run #17: n=   533, T=0.012 (s), Mflops= 25236
Run #18: n=   640, T=0.052 (s), Mflops= 10082
Run #19: n=   768, T=0.079 (s), Mflops= 11467
Run #20: n=   922, T=0.116 (s), Mflops= 13513
Run #21: n=  1107, T=0.194 (s), Mflops= 13985
Run #22: n=  1329, T=0.310 (s), Mflops= 15144
Run #23: n=  1595, T=0.463 (s), Mflops= 17527
Run #24: n=  1914, T=0.722 (s), Mflops= 19423
Run #25: n=  2297, T=1.408 (s), Mflops= 17215
Best performance: N=533, T=0.012 (s), MFLOPS=25236

The previous script produces the following figure.


21st of January 2011: NaN-Toolbox v1.2

This toolbox is for classification and statistics. This toolbox is especially written for data with missing values encoded as NaN. It is a Scilab port of the nan-toolbox for matlab/octave.

This toolbox is developped by Holger Nahrstaedt under GPL (2.1).

The classification routines are routines for train a classificator (nan_train_sc, nan_classify, svmtrain, train ) and routines for testing (nan_test_sc, predict, svmpredict) and visualisation (nan_confusionmat, nan_partest, nan_rocplot).

The Nan toolbox provides the following functions.

The Nan Toolbox is available on ATOMS:

To install it, type:


6th of February 2011: Regression tools

The toolbox regtools provides three functions for performing linear and non linear regression analysis.

The regtools module provides the following functions:

This module is developped by Torbjorn Pettersen.

It is available on ATOMS:

To install it, type:


The following is the example provided with the nlinlsq function.

deff('yhat=nlinmod(p,x)',['yhat=p(1)+p(2)*exp(p(3)*x);']); // define regression model to be fitted
deff('dydp=dnlinmod(p,x)',['dydp=[ones(x),exp(p(3)*x),p(2)*x.*exp(p(3)*x)];']); // define d(yhat)/dp
x=-[1:100]'/10; phat=[2;10;0.5];               // generate some data points
y=nlinmod(phat,x)+grand(100,1,'nor',0,1)/2;    // with with random noice added.
p0=ones(3,1); // initial estimate for the regression parameters.
// Solve nonlinear regression problem with output every 4'th iteration and nameing of model parmameters.
[p,stat]=nlinlsq(list(nlinmod),list(dnlinmod),x,y,[],p0,[],[],list(4,'A B C'));

// Solve weighted nonlinear regression problem with default names for the regression parameters
// and numerical derivatives.

// Show the difference between the two solutions...
scf(); plot(x,y,'o'); xtitle('Demo of nlinlsq()','x','y=A+B*exp(C*x)')
plot(x,nlinmod(p,x),'b-'); plot(x,nlinmod(pwt,x),'r-');
xgrid(); legend('Data','unweighted','weighted',2);

// Solve weighted nonlinear regression problem without analytical derivaties.

// Display the regression report from the previous solution.

The previous script produces the following output.

                      REPORT SUMMARY                      
           Estimate   Std. Error     t-value  Pr(>|t|)   Sign
      p(1)  1.20e+000   6.72e-002      17.81   2.41e-032  ***
      p(2)  1.03e+001   1.18e-001      87.26   5.53e-094  ***
      p(3)  4.12e-001   1.15e-002      35.73   1.26e-057  ***
Signif. codes: 0 `***´ 0.001 `**´ 0.01 `*´ 0.05 `.´ 0.1 ` ´ 1

Residual standard error: 2.78e-001 on 97 degrees of freedom

Residual sum of squares: 7.47e+000

Asymptotic confidence interval:
             2.5%        97.5%
      p(1)  1.06e+000    1.33e+000
      p(2)  1.01e+001    1.06e+001
      p(3)  3.89e-001    4.34e-001

Correlation matrix:
                 p(1)       p(2)
       p(2)     -0.095
       p(3)      0.823      0.331

 ans  =

The previous script produces the following plots.




16th of February 2011: AG_fluid_dynamics

This script implements multi-species RK3 algorithm described in paper "Computational fluctuating fluid dynamics", J.B. Bell, A. Garcia, and S. Williams, to appear in ESAIM: Mathematical Modelling and Numerical Analysis.

This script is available on the File Exchange:

Original MATLAB program written by Anton de la Fuente and ported into Scilab by David Adams, from Equalis.

-->exec('AG_fliud_dynamics.sce', -1)
Finished 5 of 100 samples; about 47.424 seconds to completion
Finished 10 of 100 samples; about 39.735 seconds to completion
Finished 15 of 100 samples; about 35.9777 seconds to completion
Finished 20 of 100 samples; about 32.948 seconds to completion
Finished 25 of 100 samples; about 30.468 seconds to completion
Finished 30 of 100 samples; about 28.6113 seconds to completion
Finished 35 of 100 samples; about 26.741 seconds to completion
Finished 40 of 100 samples; about 24.711 seconds to completion
Finished 45 of 100 samples; about 22.4608 seconds to completion
Finished 50 of 100 samples; about 20.327 seconds to completion
Finished 55 of 100 samples; about 18.2135 seconds to completion
Finished 60 of 100 samples; about 16.276 seconds to completion
Finished 65 of 100 samples; about 14.2046 seconds to completion
Finished 70 of 100 samples; about 12.1881 seconds to completion
Finished 75 of 100 samples; about 10.1243 seconds to completion
Finished 80 of 100 samples; about 8.077 seconds to completion
Finished 85 of 100 samples; about 6.03724 seconds to completion
Finished 90 of 100 samples; about 4.02133 seconds to completion
Finished 95 of 100 samples; about 2.01568 seconds to completion
Finished 100 of 100 samples; about 0 seconds to completion
Total time elapsed: 40.389 seconds

Conserved variables:     (Initial)  /  (Final)
Density            :       0.00178  /  0.00178 
Momentum           :             0  /  -2.47025e-018 
Energy             :  1.01185e+006  /  1.01185e+006 

Variances and Covariances
           (Measured)   : (Theory)     (Percent Error)
rho     =  6.06307e-010 : 1.19915e-008  -94.94  %
Jx      =  2.9168       : 3.40832       -14.42  %
Energy  =  3.27026e+009 : 4.84371e+009  -32.48  %
rho1    =  2.28284e-009 : 2.99787e-009  -23.85  %
Rho-E   =  0.311457     : 5.11248       -93.91  %

3rd of March 2011: Wavelab v1.0

WaveLab is a library for wavelet analysis, wavelet- packet analysis, cosine-packet. This toolbox is developped by Holger Nahrstaedt and David Donoho.

This toolbox is a Scilab port of the Matlab Wavelab toolbox developped at stanford:

The Matlab Wavelab toolbox is currently developped by

with major contribution from

Previous Wavelab team members include:

The toolbox has the following main features:

This toolbox provides more than 300 functions:

This module provides 65 demonstrations:

The following plot is from the demo "FBI Fingerprint Compression". The United States Federal Bureau of Investigation uses a fixed Wavelet Packet basis to compress fingerprints. Here we illustrate the compression of a sample fingerprint in this basis. The following script is the first part of the demo.

finger = ReadImage('Fingerprint');
fbi_tree = BuildFBITree(9);
ax = a.data_bounds;
title('Partition by FBI Basis');

The previous script produces the following output.

The following plot shows first- and best- 10% reconstructions and the errors.

8th of March 2011: Particle Swarm Optimization Toolbox, v0.2

The Particle Swarm Optimization Toolbox by Sébastien Salmon was updated 8th of March 2011.

The PSO method, published by Kennedy and Eberhart in 1995, is based on a population of points at first stochastically deployed on a search field. Each member of this particle swarm could be a solution of the optimization problem. This swarm flies in the search field (of N dimensions) and each member of it is attracted by its personal best solution and by the best solution of its neighbours. Each particle has a memory storing all data relating to its flight (location, speed and its personal best solution). It can also inform its neighbours, i.e. communicate its speed and position. This ability is known as socialisation. For each iteration, the objective function is evaluated for every member of the swarm. Then the leader of the whole swarm can be determined: it is the particle with the best personal solution. The process leads at the end to the best global solution. This direct search method does not require any knowledge of the objective function derivatives.

This module provides the following functions:

This project is managed on the Forge :

and is available on ATOMS:

To install it:


15th of March 2011: FreeASM

FreeASM Scilab is a simple code and freely accessible to the simulation of activated sludge processes.

The author of this module is Julien Laurent, Lecturer at the Institute of fluid mechanics and solid (IMFS) of ENGEES in Strasbourg. FreeASM1 is a set of Scilab scripts to simulate a very easy method of activated sludge used to treat municipal wastewater.

-->exec FASM1+pointsettler_steady_state.sce;
 Q_inf =
 Q_was =
 Q_eff =
 was =
 Q_rec =
 So_sat =

The previous script produces the following figure.


23rd of March 2011: Crystal Structure Animation v2.0

This script has been developped by Tadayuki Nakajima. It displays animated crystal structures.

Crystal Structures

In the version 2.0, new structures are added:

For example, consider the following script:

//La0.33Sr0.67CoO3 (LSCO) Structure --------------------------------------------
clf(); //To clear the previous plot
cf = gcf();
cf.pixmap = 'on';
cf.color_map = [bonecolormap(128);oceancolormap(384);coppercolormap(256);bonecolormap(256)];
ColormapSize = size(cf.color_map, "r")/8; //get the colormap size

a1 = [1;0;0]; //a1,a2,a3 :primitive axes
a2 = [0;1;0];
a3 = [0;0;1];
Co0 = [1/2 1/2 1/2];
Co = Co0+[0 0 0];
O = [Co0;Co0;Co0]+[[-1/2 0 0];[0 -1/2 0];[0 0 -1/2]];
RA = [GetUnitCell(Co, 2:2, 0:2, 0:3);GetUnitCell(Co, 0:2, 2:2, 0:3);GetUnitCell(Co, 0:2, 0:2, 3:3)];
PlotAtoms(1, RemoveAtoms(GetUnitCell(Co, 0:2, 0:2, 0:3), RA), 0.07);
PlotAtoms(8, GetUnitCell(O, 0:2, 0:2, 0:3), 0.05);

a1 = [1;0;0]; //a1,a2,a3 :primitive axes
a2 = [0;1;0];
a3 = [0;0;3];
Sr = [[0 0 1];[0 0 2]]*1/3;
La = [0 0 0];
PlotAtoms(3, GetUnitCell(La, 0:2, 0:2, 0:1), 0.1);
PlotAtoms(2, GetUnitCell(Sr, 0:2, 0:2, 0:1), 0.1);
LaSr = [La;Sr];
ConnectAtoms(1, GetUnitCell(LaSr, 0:2, 0:2, 0:1), 1, 5/8*ColormapSize, 1);

xtitle('$La_{0.33}Sr_{0.67}CoO_{3}\;(LSCO)\; Structure$');
ca = gca(); //get the current axes
ca.tight_limits = "on";
ca.title.font_foreground = 6/8*ColormapSize;
ca.title.font_style = 1; //1 to 10
ca.title.font_size = 4;
n = 0;
while n <= 360
    ca.rotation_angles = [75, 300 + n];
    n = n + 0.2; 

The previous script produces the following output.

Notice that we must set the pixmap field "off" before being able to export this figure:

cf = gcf();

25th of March 2011: Low Discrepancy Sequences v0.2

This is the change log for version 0.2.

This toolbox is available in ATOMS at :

and is managed in the Scilab Forge :

This module has already been reviewed at Low Discrepancy Sequences

27th of April 2011: Matrix Market v1.4

Here is the changelog for the version 1.4:

This module is available in ATOMS :

The is managed on the Forge since April 2011:

The version 1.4 is the result of the work of a new contributor to this project, Benoit Goepfert.

This module has already been reviewed at

6th of June 2011: Linear Algebra v0.1

The goal of this toolbox is to provide a collection of algorithms for linear algebra.

These algorithms are most of the time already provided by Scilab, but are available here for comparison purpose.

The linalg_pow function is much faster than Scilab's pow, when the exponent is large. The algorithm used here is based on binary exponentiation, and requires only log2(p) iterations, compared to p iterations for the naive pow. For example, for p=99999, it was found that linalg_pow requires 0.003 seconds for a 5-by-5 matrix, while Scilab requires 2.7 seconds.

The linalg_zhbev function provides the same feature as Lapack's ZHBEV, that is, computes the eigenvalues of a complex hermitian band matrix. The other method in Scilab to compute eigenvalues of sparse matrices is to use Arnoldi's iterations. This does not make use of the Hermitian structure of some matrices.

The following list presents the functions in this module:

The linalg project is managed on the Forge:

and available on ATOMS:

To install it, type in the Scilab console:


and restart Scilab.

The linalg_chol function returns the Cholesky decomposition of a matrix. Of course, Scilab already provides the "chol" function, which provides the same feature. The "chol" function is based on Lapack, which provides a robust and efficient Cholesky decomposition. The gateway of the "chol" function in Scilab is in the "linear_algebra" module:;a=blob;f=scilab/modules/linear_algebra/sci_gateway/c/sci_chol.c;h=ea1629d4f83cfb3135e0894088681be966682d77;hb=HEAD

From there, we see that, for a real matrix, Scilab uses the Lapack function dpotrf :

This prevents the user from being able to experiment how the algorithm of the Cholesky decomposition works: the code is in Fortran, not in the Scilab language itself. The goal of the linalg_chol function is to provide a Scilab-based Cholesky decomposition. Of course, this algorithm will be less efficient than Scilab's compiled source code. Even worst, Scilab uses optimized linear algebra libraries (e.g. ATLAS or the Intel MKL), so that the performance of the linalg_chol function may be disappointing. However, in the context of Scilab, we can edit the linalg_chol source code and experiment interactively much more easily than with a Fortran source code. Therefore, if we want to learn how the algorithm is designed (e.g. during a training session), analyzing the linalg_chol function is a much simpler way to work.

For example, consider the following matrix C:

C = [
1 0 0 0
1 2 0 0
1 2 3 0
1 2 3 4

We can create the symmetric matrix A by multiplying C by its transpose:

A = C*C';

This produces the matrix:

 A  =
    1.    1.    1.     1.   
    1.    5.    5.     5.   
    1.    5.    14.    14.  
    1.    5.    14.    30.  

Then we use the linalg_chol function to compute the Cholesky decomposition of A. The script



 L  =
    1.    0.    0.    0.  
    1.    2.    0.    0.  
    1.    2.    3.    0.  
    1.    2.    3.    4.  

The built-in "chol" function produces the same matrix (but transposed):

 ans  =
    1.    1.    1.    1.  
    0.    2.    2.    2.  
    0.    0.    3.    3.  
    0.    0.    0.    4.  

The difference is that we can edit the linalg_chol function, simply by editing its source code. The statement:

-->edit linalg_chol

opens Scilab's editor and let the user read the source code of the linal_chol function. At the core of the algorithm, we see the following simple Cholesky decomposition algorithm:

    for j=1:n
        if ( j > 1 ) then
            A(j:n,j) = A(j:n,j) - A(j:n,1:j-1)*A(j,1:j-1)'
        if (A(j,j)<=0 | isnan(A(j,j))) then
            error(msprintf("%s: The matrix is not positive definite.","linalg_chol"))
        A(j,j) = sqrt(A(j,j))
        A(j+1:n,j) = A(j+1:n,j)/A(j,j)
    L = tril(A)

8th of June 2011: Mathieu functions v2.0

This Mathieu Functions Toolbox is used to solve Mathieu function numerically.

The Mathieu equation is a second-order homogeneous linear differential equation

and appears in several different situations in Physics: electromagnetic or elastic wave equations with elliptical boundary conditions as in waveguides or resonators, the motion of particles in alternated-gradient focussing or electromagnetic traps, the inverted pendulum, parametric oscillators, the motion of a quantum particle in a periodic potential, the eigenfunctions of the quantum pendulum, are just few examples. Their solutions, known as Mathieu functions, were first discussed by Mathieu in 1868 in the context of the free oscillations of an elliptic membrane.

The toolbox has 8 demos. All demos can be acessed from "?->Scilab Demonstrations"

This module provides the following functions:

This module is developped on Scilab's Forge:

This module is available on ATOMS:

The orignal authors of this toolbox are R.Coisson and G. Vernizzi from Parma University. Then the toolbox has been developped by X. K. Yang and is currently developped and maintained by Nikolay Strelkov and Michaël Baudin.

The toolbox provides the following demonstrations:

The mathieu_elliptical function creates a 3D plot of a mode with elliptical boundary conditions. This function is used in the demo "Comparison of 4 modes with q=0 and q=8, even & odd", which uses the following script:


The previous script produces the following plot.


20th of July 2011: New Module: NIST Datasets v0.2

The goal of this toolbox is to provide a collection of datasets distributed by NIST.

The NIST Standard Reference Datasets is a collection of datasets. The purpose of this project is to improve the accuracy of statistical software by providing reference datasets with certified computational results that enable the objective evaluation of statistical software.

See the overview in the help provided with this toolbox.

The following is a list of functions in this toolbox.

Moreover, the module provides 34 datasets from NIST in the following categories:

Datasets from other categories are provided on the NIST website, which cannot be read by the current toolbox. However, it should be straightforward to extend the current toolbox to read the other categories of files.

This module is developped on the Forge :

and is available on ATOMS:

To install it, type:


The nistdataset_read function reads a dataset from NIST. In the following example, we read the Gauss2 dataset in Scilab.

path = nistdataset_getpath();
filename = fullfile(path,"datasets","nls","lower","Gauss2.dat");
data = nistdataset_read(filename)

The previous script produces the following output:

-->data = nistdataset_read(filename)
 data  =

name: Gauss2
category: Nonlinear Least Squares Regression
         The data are two slightly-blended Gaussians on a
         decaying exponential baseline plus normally
         distributed zero-mean noise with variance = 6.25.
         Rust, B., NIST (1996).
         1 Response  (y)
         1 Predictor (x)
         250 Observations
         Lower Level of Difficulty
         Generated Data
         Exponential Class
         8 Parameters (b1 to b8)
residualSumOfSquares: 1247.5282
residualStandardDev: 2.270479
degreeFreedom: 242
numberOfObservations: 250
x: 250-by-1 constant matrix
y: 250-by-1 constant matrix
start1: 8-by-1 constant matrix
start2: 8-by-1 constant matrix
parameter: 8-by-1 constant matrix
standarddeviation: 8-by-1 constant matrix
sampleMean: []
sampleSTD: []
sampleAutocorr: []

From there, it is easy to access to the x and y fields of the data structure:

 ans  =
    250.    1.  
 ans  =
 ans  =
    250.    1.  
 ans  =

For example, the following script:


The previous script produces the following output:


27th of July 2011: CelestLab v2.2.0

CelestLab is a library of space flight dynamics functions written in Scilab. This library has been developed and is maintained by the CNES (Centre National d’Etudes Spatiales) for mission analysis purposes. The library is used by CNES for the trajectory analysis and orbit design for various type of missions. CelestLab contains about ten modules that allow to perform various tasks such as: orbit extrapolation, attitude computation, elementary manoeuvre computation, change of reference frame, change of coordinates,…CelestLab has been validated against the CNES flight dynamics software legacy. Every function, is described, in its own help page with selected examples.

This module is available in ATOMS :

To install it, type


This module has already been reviewed at:

Celestlab - 23rd November 2009

public: New Scientific Features in 2011 (last edited 2012-07-16 14:05:49 by