Saturday, July 3, 2010

Scilab, a matlab-like environment, only it is free!

Scilab is a free (with compatible GPL license) Matlab like software for interactive numerical computation developed by French academics/programmers at INRIA. It has been developed through the years and has acquired sophisticated libraries for various applications, such as optimization, linear algebra, parallel computing, signal processing, simulation and other fields. If you cannot afford MATLAB, then your can afford Scilab. Scilab competes with R, Octave, Euler,Python-Scipy/Scientific, but if you do choose Scilab for your applied mathematics research work, Scilab will not disappoint. The wealth of free tools may make the user dizzy what to choose, in fact, one may resort to a hybrid approach using one or more of the available tools. As if to emphasize the enriched environment, Scilab has interfaces to computational codes in scientific libraries written in various languages such as fortran and C/C++. If you want the cheapest, fastest in implementing a comutational algorithm form conception to implementation and production stage, Scilab might win easily.

Scilab is hosted at Scilab homepage. All documentation, sources, libraries may be found there for quick downloads.

Scilab has a gui-console. Here are some examples. Scilab might take some time to initialize when it is invoked from the command line or graphical shell. Here is what you may see:


If you are very new to Scilab, the easiest way to feel at ease is to let Scilab demonstrate to you what it can do. Click on ?/Scilab Demonstrations. Select introduction. And Scilab will give you a basic tutorial! Press ENTER key to continue.Here is a snapshot of a Scilab introduction session:

 >>//               SCILAB OBJECTS
>>//               SCILAB OBJECTS
>>//               1. SCALARS
>>a=1               //real constant
 a  =
 
    1.  
>>1==1              //boolean
 ans  =
 
  T  

-->
>>'string'          //character string
 ans  =
 
 string   
>>
>>z=poly(0,'z')     // polynomial with variable 'z' and with one root at zero
 z  =
 
    z   
>>
>>p=1+3*z+4.5*z^2   //polynomial 
 p  =
 
                 2  
    1 + 3z + 4.5z   >>r=z/p             //rational
 r  =
 
          z         
    -------------   
                 2  
    1 + 3z + 4.5z   
>>//                2. MATRICES
>>A=[a+1 2 3
>>     0 0 atan(1)
>>     5 9 -1]      //3 x 3 constant matrix
 A  =
 
    2.    2.    3.         
    0.    0.    0.7853982  
    5.    9.  - 1.         
>>b=[%t,%f]         //1 x 2 boolean matrix
 b  =
 
  T F  
>>Mc=['this','is';
>>    'a' ,'matrix']   //2 x 2 matrix of strings
 Mc  =
 
!this  is      !
!              !
!a     matrix  !
>>Mp=[p,1-z;
>>    1,z*p]        //2 x 2 polynomial matrix
 Mp  =
 
                 2                    
    1 + 3z + 4.5z     1 - z           
                                      
                            2      3  
    1                 z + 3z + 4.5z   
>>F=Mp/poly([1+%i 1-%i 1],'z')   //rational matrix
 F  =
 
                  2                       
     1 + 3z + 4.5z        - 1             
    ---------------     ---------         
               2   3              2       
  - 2 + 4z - 3z + z     2 - 2z + z        
                                          
                               2      3   
           1             z + 3z + 4.5z    
   ---------------     ---------------   
               2   3               2   3  
  - 2 + 4z - 3z + z   - 2 + 4z - 3z + z   
>>Sp=sparse([1,2;4,5;3,10],[1,2,3])   //sparse matrix
 Sp  =
 
(    4,   10) sparse matrix
 
(    1,    2)        1. 
(    3,   10)        3. 
(    4,    5)        2. 
>>Sp(1,10)==Sp(1,1)                   //boolean sparse matrix
 ans  =
 
(    1,    1) sparse matrix
 
(    1,    1)    T 
>>//                 3. LISTS
>>L=list(a,-(1:5), Mp,['this','is';'a','list'])   //list
 L  =
 
 
       L(1)
 
    1.  
 
       L(2)
 
  - 1.  - 2.  - 3.  - 4.  - 5.  
 
[Continue display? n (no) to stop, any other key to continue]

We encourage the reader to install scilab using your package installer in Linux. The version I have
is 5.2.1. Scilab is also available for MS Windows.

We will present some tools-libraries available in Scilab in the future. Stay tuned.

No comments:

Post a Comment