Sunday, May 20, 2018

MathLab for the baggars

Introduction


Want to use a computer algebra tool but you can afford it? A nice alternative i encountered recently is SciLab (see http://www.scilab.org/), which is very much like MATHLAB for numerical computation and simulation and as of today it is open source and consequently much more affordable then MathLab. It contains a neat graphical subsystem which unfortunately does not work out of the box since the version 5.5.X  (see Error Report).

Fig.1 The function values of D(x,y) projected  on  a 2d canvas.

Fixing the Grafics stuff with Fedora Workstation 28.

But it can be fixed with a few configuration changes. In the installation directory of SciLab you will find in the bin directory a file scilab-adv-cli where you can disable the usage of the OpenGL hardware support. The line below has to be added to to this file:

# * That is all. Don't hesitate to contact us if you see one missing.
#
###
LIBGL_ALWAYS_SOFTWARE=1
After you have done this change start SciLab and run the command plot() which should
draw some test pattern in a drawing window.

x=[0:0.1:2*%pi];
plot(x,sin(x));




The following lines create the sin curve in the figure below.

Fig. 2 simple sin(x) created by the lines above
Some time ago i did a small project called Huygens. The intention was to
demonstrate and evaluate various tools for presenting data. One topic i am presenting on my Wave Optics page some calculated interference pattern. Basically for every point (x,y) on a 2 dimensional the intensity has to be calculated. In SciLab the essential part looks as below. D is the function which calculates the intensity at x,y on the canvas. The complete process of displaying a picture like Fig. 1 are the few lines below:





function result=D(x, y)
result = sqrt(x*x + y*y);
endfunction;
clf ; fgrayplot([-100:100], [-100:100], D);

which is really neat. For more information on grayplot refere to the reference 
page.
 




References

There are a few tutorials on youTube which found very help full for the begin! 
  1. https://www.scilab.org/content/download/849/7901/file/Scilab_beginners.pdf
  2. https://www.youtube.com/watch?v=cS6d9Q5SWpg
  3. https://www.youtube.com/watch?v=HkYU2JPbIH8&list=PLaOgJg5lTevD0iI9H6B22ZHbUrV-l6kUJ
  4. https://www.youtube.com/watch?v=Oy0uvymn8wU&t=3089s