Scilab Presentation for Tech Talk Tuesday 21 July 2015

40
LEE Kar Heng, Ph.D Chief, TBSS Group SCILAB IN VIETNAM An Introduction to Scilab for Tech Talk Tuesday, Ho Chi Minh City

Transcript of Scilab Presentation for Tech Talk Tuesday 21 July 2015

Page 1: Scilab Presentation for Tech Talk Tuesday 21 July 2015

LEE Kar Heng, Ph.DChief, TBSS Group

SCILAB IN VIETNAMAn Introduction to Scilab

for

Tech Talk Tuesday, Ho Chi Minh City

Page 2: Scilab Presentation for Tech Talk Tuesday 21 July 2015

2

SCILAB ENTERPRISES

• Founded in June 2010• The official publisher and professional services provider of

Scilab software• Provides expertise in the implementation of optimal

solutions in terms of technological innovation and helping companies to make the right decisions in computation and simulation tools

• Our team is comprised of engineers and doctors of science from higher education schools or universities, graduated in mathematics, automation, telecommunications, physics or computer science

• http://www.scilab-enterprises.com/

Page 3: Scilab Presentation for Tech Talk Tuesday 21 July 2015

3

THE TBSS-SCILAB PARTNERSHIP

• TBSS became the business partner for Singapore and Vietnam of Scilab in 2013.

• In 2014, TBSS-Scilab Singapore was incorporated to handle the Scilab business in Singapore.

• In Vietnam, the business is represented by TBSS Khai Kinh Company Limited.

• http://www.scilab-enterprises.com/partners/ourpartners

Page 4: Scilab Presentation for Tech Talk Tuesday 21 July 2015

4

THE TBSS-SCILAB PARTNERSHIP

• Oversees and Manages Scilab activities in – Training and Education– Project and Consultancy – Migration and Deployment– Specialized Developments– Scilab User Group Management, Operations and

Support• Manages, administers and funds the Singapore

and Vietnam Scilab User Groups• Manages Scilab projects in Singapore and

Vietnam

Page 5: Scilab Presentation for Tech Talk Tuesday 21 July 2015

5

THE SCILAB CHALLENGE PROJECT

• Scilab Challenge 2014/2015 requires students to work on a project that uses Scilab as the main scientific tool in the simulation and computation of the solution to the problem they are investigating

• Top 3 projects will be presented with cash prize, certificate and medal

• All participants will be presented certificate and medal• Identified projects will be required to submit a technical

paper to the ScilabTEC2015 Committee• The selected project team member will be sponsored to

present the findings at the ScilabTEC Conference in Paris• In May 2015, one project was presented at ScilabTEC

Page 6: Scilab Presentation for Tech Talk Tuesday 21 July 2015

6

PROJECT OBJECTIVES

• To promote use of Scilab in academic institutions, currently Scilab-Singapore have challenge projects with NTU and TP

• To facilitate the use of Scilab to solve a specific problem

• To enable the students appreciate Scilab• To provide a channel for students to present

findings in the ScilabTEC conference, Paris• To reward capable students accordingly

Page 7: Scilab Presentation for Tech Talk Tuesday 21 July 2015

BENEFITS

• Scilab is an open-source software, hence there is NO licensing issue

• Gain skillset in use of Scilab• Participation in project gives advantage in

seeking employment• Participation in international conference is

widely accepted as a professional recognition• Possibility to work for Scilab Enterprise, TBSS-

Scilab or other Scilab partners7

Page 8: Scilab Presentation for Tech Talk Tuesday 21 July 2015

8

• The conference was held from 20 to 21 May in Paris• TBSS was represented by Dr Lee and Miss Li Kexin• Le would be presenting the project “Taxi on the

Way”• Lee would be meeting the management staff of

Scilab and confirming the representation of new products in Singapore and/or Vietnam

THE SCILABTEC INTERNATIONAL CONFERENCE 2015

Page 9: Scilab Presentation for Tech Talk Tuesday 21 July 2015

9

• The presented topics covered a wide range of specialized areas

• The TBSS team learned how Scilab has been used by other professionals

• It was a great program with knowledge sharing and networking

THE SCILABTEC INTERNATIONAL CONFERENCE 2015

Page 10: Scilab Presentation for Tech Talk Tuesday 21 July 2015

10

• Lee with Jocelyn, the Marketing Director who is the first contact of Lee in Scilab

THE SCILABTEC INTERNATIONAL CONFERENCE 2015

• Jocelyn had facilitated the partnership between TBSS and Scilab

Page 11: Scilab Presentation for Tech Talk Tuesday 21 July 2015

11

• Lee visited Scilab in Jan 2014 and got acquaintance with Dr Gomez and Ms Julie

THE SCILABTEC INTERNATIONAL CONFERENCE 2015

• Dr Gomez is the Advisor and immediate past CEO of Scilab

• Ms Julie is the Communications and Public Relations Manager of Scilab

Page 12: Scilab Presentation for Tech Talk Tuesday 21 July 2015

12

• Mr Aphan took over Scilab recently

• Lee had a good meeting with Mr Aphan on the progression of the partnership in terms of training, 3rd party products and Scilab Academy in Asia.

THE SCILABTEC INTERNATIONAL CONFERENCE 2015

Page 13: Scilab Presentation for Tech Talk Tuesday 21 July 2015

13

• Kexin presented the project with good presentation slides and confident.

THE SCILABTEC INTERNATIONAL CONFERENCE 2015

Page 14: Scilab Presentation for Tech Talk Tuesday 21 July 2015

14

• TBSS practices Corporate Social Responsibility• Scilab Challenge is an initiative that allows outreach

of Scilab and provision of opportunity for students to experience knowledge sharing in international events

• https://www.facebook.com/groups/TBSSCharity/

THE TBSS CSR

Page 15: Scilab Presentation for Tech Talk Tuesday 21 July 2015

SUPPORT

• Community support– TBSS-Scilab User Group at Facebook (General enquiries on

Scilab)– Specific project Facebook group, example: the Scilab

Challenge@NTU 2014/2015 (Project related matters, announcement, …)

• Contact – Lee Kar Heng ([email protected]) (project matters)– Tan Thiam Huat ([email protected]) (Scilab

matters)

Page 16: Scilab Presentation for Tech Talk Tuesday 21 July 2015

1 - Scilab made by Inria

2003 – 2007: Scilab Consortium phase 1 (Inria)2008 – 2012: Scilab Consortium phase 2 (DIGITEO

Foundation) 2008: Free Scilab (GPL compatible) 2009: Xcos industrialization

1980: first MATLAB1980 – 1990: BASILE software at Inria / Simulog

2010: Transfer to Scilab Enterprises Company2012: Exclusivity of trademark, development and publishing of

Scilab

1990 – 2003: Open Source Scilab (Research) Scilab freely distributed on the Net in

1994

2 - Scilab industrialization

3 – Scilab Enterprises

HISTORY

Page 17: Scilab Presentation for Tech Talk Tuesday 21 July 2015

• ScilabPowerful Computation Engine

• XcosDynamic Systems Modeling and Simulation

• ATOMS (AuTomatic mOdules Management for Scilab)Module Management

SCILAB DISTRIBUTION

Page 18: Scilab Presentation for Tech Talk Tuesday 21 July 2015

• High level programming language

• Hundreds of mathematical functions

• Advanced data structures & user-defined data types

• Computation engine easy to embed into applications

• Open System: extended capabilities with professional & specialized modules

SCILAB: FREE AND OPEN SOURCE

Page 19: Scilab Presentation for Tech Talk Tuesday 21 July 2015

• Mathematical functions• Matrix computation, sparse

matrices• Polynomials and rational

functions• Simulation: ODE and DAE• Classic and robust control, LMI

optimization • Differentiable and non

differentiable optimization• Interpolation, approximation• Signal processing• Statistics• Xcos: hybrid dynamical

systems modeler and simulator

More than 2,000 functions:

KEY SCIENTIFIC FEATURES

Page 20: Scilab Presentation for Tech Talk Tuesday 21 July 2015

• Dynamic System Modeling and Simulation

• A user-friendly GUI-based editor for modeling and simulating hybrid dynamical systems as block diagrams: model construction, edition and customization

• Integrated Modelica Compiler

• Freely Available and distributed with Scilab

XCOS

Page 21: Scilab Presentation for Tech Talk Tuesday 21 July 2015

• Graphically model, compile, and simulate dynamical systems

• Combine continuous and discrete-time behaviors in the same model

• Select model elements from Palettes of standard blocks

• Program new blocks in C, Fortran, or Scilab language

• HDF5 standard which has been chosen to guarantee data exchanges between Scilab and Xcos Editor

• Free Modelica compiler which enables the simulation of implicit diagrams

• Graphical user interface based on JGraphX

XCOS MAIN FEATURES

Page 22: Scilab Presentation for Tech Talk Tuesday 21 July 2015

Variable Browser

File Browser

Command History

Console

PROGRAMMING ENVIRONMENT

Page 23: Scilab Presentation for Tech Talk Tuesday 21 July 2015

2-D/3-D VisualizationEditor

Embedded Help

External Modules Manager

Variable Editor

PROGRAMMING ENVIRONMENT

Page 24: Scilab Presentation for Tech Talk Tuesday 21 July 2015

• Great number of functionalities to create Graphical User Interfaces

• Accessible from Scilab

• Interaction between GUI and plots

• Fully integrated in OS environment

GRAPHICAL USER INTERFACES

Page 25: Scilab Presentation for Tech Talk Tuesday 21 July 2015

What’s new?

• Graphics: speed (Matplot), datatips, interactions, 3-D lightning

• Graphical User Interface: new UI Controls

• Remote file Access (sciCurl)

• Scilab/MPI (Message Passing Interface)

• Java Integration (JIMS)

• HDF5 management

• Localization of external modules

Works under Windows XP/Vista/7/8, GNU/Linux and Mac

OS X, 32 bits and 64 bits

• Mathematics and linear algebra

• Simulation

• Visualization

• Control

• Optimization

• Probabilities, statistics

• Signal processing

LATEST RELEASE SCILAB 5.5.2

Page 26: Scilab Presentation for Tech Talk Tuesday 21 July 2015

• Management of C, C++, Fortran, Java, Python, .net... from Scilab: JIMS module for Java

• Available as a computing engine with C, C++, Java, Python, .net API...

• Links with: – Excel®, COM/DCOM® (Microsoft),

– Labview® (National Instruments),

– Isight® (Dassault Systèmes),

– Alternova® (Eurodecision),

– modeFRONTIER® (ESTECO),

– etc.

• [Video] Interface Scilab to Arduino

LINKS WITH OTHER LANGUAGES

Page 27: Scilab Presentation for Tech Talk Tuesday 21 July 2015

About 100,000 monthly downloads from 150 countries on www.scilab.org

DOWNLOADS

Page 28: Scilab Presentation for Tech Talk Tuesday 21 July 2015

28

DOWNLOADS

Page 29: Scilab Presentation for Tech Talk Tuesday 21 July 2015

Main industrial sectors

• Aerospace: Airbus Group, CNES, Safran, Dassault Aviation

• Transportation: Renault, LEONI, Siemens, Alstom, Faurecia

• Mechanical: ArcelorMittal, Aperam

• Energy: EDF, RTE, CEA, Total, IFP

• Defence: DGA, THALES• Health: SANOFI• Telecom: Orange• Earth Science: BRGM, Eramet

Academics, education High schools (French high

schools) Engineering schools (TP, …) Universities (HCMUT, NUT,

SUTD, …)

In red: Scilab Enterprises customers

USERS

Page 30: Scilab Presentation for Tech Talk Tuesday 21 July 2015

Scilab is free software

– Easy to install everywhere

– Large community of users

But freedom is not enoughA friendly software with a lot of functionalities

– Included toolboxes for most of applied mathematics

– Own dedicated OpenGL graphics

– Xcos comparable to Simulink

– Easy to add interactively external module

A comprehensive organization takes care of Scilab

– Scilab developed professionally by Scilab Enterprises

– Supports and services

– IPC Scilab Users Group with important Companies

CHANGING TO SCILAB

Page 31: Scilab Presentation for Tech Talk Tuesday 21 July 2015

Scilab is not a clone of Matlab• Very similar languages• Same simple graphics functions: plot, bar, mesh, pie,

surf

• But different syntax and semantics for many functions:- Syntax example: “eigen” vs. “spec”- Semantics example: “max” function- Different management of source files

Matlab / Scilab dictionary available in the Scilab help

SCILAB … MATLAB

Page 32: Scilab Presentation for Tech Talk Tuesday 21 July 2015

• Matrix computations:A=rand(1000,1000); b=rand(1000,1);x=A\b; norm(A*x-b)vp=spec(A);

• 2D plots:plot(real(vp),imag(vp),"*r");x=linspace(-%pi,%pi,1000);clf; plot(x,sin(x),"r",x,cos(x),"g");

3D curve:k=tan(%pi/27);t=linspace(-40,40,1000);x=cos(t)./cosh(k*t); y=sin(t)./cosh(k*t); z=tanh(k*t);clf; param3d(x,y,z);

SCILAB AS A CALCULATOR

Page 33: Scilab Presentation for Tech Talk Tuesday 21 July 2015

3D beautiful surface: 90,000 pointsfunction z=f(x,y) // function defining the surface z=exp(exp(-x^2-y^2)*(exp(cos(x^2+y^2)^20)+.. 8*sin(x^2+y^2)^20+2*sin(2*(x^2+y^2))^8));endfunctionx=linspace(-1.5,1.5,300); y=linspace(-1.5,1.5,300); z=feval(x,y,f);f=scf(0); f.color_map=rainbowcolormap(32);surf(x,y,z); // plot the surfacee=gce(); e.color_mode=-1;a=gca(); a.box="off";a.axes_visible=["off","off","off"];a.x_label.visible="off";a.y_label.visible="off";a.z_label.visible="off";

SCILAB AS A CALCULATOR

Page 34: Scilab Presentation for Tech Talk Tuesday 21 July 2015

To plot data in 2D with color according to the value of the points, modify data and then plot again

Data are given in text file mandel.txt (2 million points, 19 Mb).1. Put data into Scilab matrix M:

M=fscanfMat("mandel.txt");2. Open graphics window, choose beautiful colormap and

plot points according to its value:f=scf(1); f.color_map = rainbowcolormap(256);Matplot(M);

3. Discard points with value between 50 and 210 and plot in another window:M(find(50<M & M<210))=1;f=scf(2); f.color_map = rainbowcolormap(256);Matplot(M);

SCILAB AS A PLOTTING TOOL

Page 35: Scilab Presentation for Tech Talk Tuesday 21 July 2015

First plot Second plot

Plotting is instantaneous:

SCILAB AS A PLOTTING TOOL

Page 36: Scilab Presentation for Tech Talk Tuesday 21 July 2015

To read text file takes time:M=fscanfMat("mandel.txt"); // 5 seconds

1. Save matrix into binary SOD (Scilab Open Data) based on HDF5 standard:save("mandel.sod","M"); // 0.04 second

2. Loading into Scilab is now very fast:load("mandel.sod"); // 0.1 second

SCILAB FILE HANDLING

Page 37: Scilab Presentation for Tech Talk Tuesday 21 July 2015

• Friendly editor, powerful mathematical language close to natural language:

function u=Newton(f,fprim,u0,eps) u=u0; while abs(f(u))>eps then fp=fprim(u); if abs(fp)<=%eps then error("singularity") end u=u-f(u)/fp endendfunction

About 1,300 Scilab functions are written in Scilab

SCILAB PROGRAMMING

Page 38: Scilab Presentation for Tech Talk Tuesday 21 July 2015

function x=Gauss(A,b,eps) n=size(b,"*"); x=b; for k=1:n-1 // when the diagonal term is close to 0 // searching for a non zero element in the column if abs(A(k,k))<eps then kk=find(abs(A(k:n,k))>eps); if kk==[] then disp(“Non invertible Matrix"); return; end // exchanging lines k and kk in A and in b kk=kk(1); lignek=A(k,:); A(k,:)=A(kk,:); A(kk,:)=lignek; lignek=b(k); b(k)=b(kk); b(kk)=lignek; end

Gaussian elimination with partial pivoting:

Scilab vectorized syntax

SCILAB PROGRAMMING

// Gauss algorithm for l=k+1:n p=A(l,k)/A(k,k); for m=k:n A(l,m)=A(l,m)-A(k,m)*p; end x(l)=x(l)-x(k)*p; end end if abs(A(n,n))<eps then disp("Non invertible Matrix "); return; end // compute x x(n)=x(n)/A(n,n); for i=n-1:-1:1 s=0; for j=i+1:n s=s+A(i,j)*x(j); end x(i)=(x(i)-s)/A(i,i); endendfunction

Page 39: Scilab Presentation for Tech Talk Tuesday 21 July 2015

Save and load GUI as XML files :• Save GUI with:

saveGui(f,"mygui.xml");

• Load GUI with:f=loadGui("mygui.xml");

New components, speed, default look and feel of the OS

GUI WITH SCILAB 5.5.2

Page 40: Scilab Presentation for Tech Talk Tuesday 21 July 2015

Scilabis

The Professional Free Software for Numerical

Computation

Industry, Education and Research