📜 ⬆️ ⬇️

FOSS solutions for mathematical computing on a computer. Part 1 - Octave

Octave - High-level language mainly intended for mathematical calculations. The syntax is similar to the Matlab syntax, besides it fully supports it (well, Matlab understandably does not always support the Octave syntax).
Supports the creation of graphs using GNUPlot.
There are versions for both * nix systems and Windows.
For KDE, there is KOctave - a graphical frontend, maybe there is something similar for other WM / DE / systems
A little more detail:
If you know what Matlab can do, then you can imagine what Octave can do, although of course its functionality is somewhat less in specific areas (Who does not know, Matlab has many different extensions necessary for areas from linguistics to astrophysics)

The syntax is quite pleasant, logical: you can declare your functions, you can create files that are functions at once and simply call them by the file name.
In addition, there is a normal mode - command line mode.

Here is the first example to determine the function of factorial (although it is already in the octave without it):
################################################## ################
## usage: answer = lg_factorial4 (n)
##
## Returns the factorial of n (n!). n should be a positive
## integer or 0.
')
function answer = lg_factorial4 (n)

if (nargin! = 1)
usage ("factorial (n)");
elseif (! isscalar (n) ||! isreal (n))
error ("n must be a positive integer value");
elseif (n <0)
error ("there is no definition for negative factorials");
endif
if (n == 0)
answer = 1;
return;
else
answer = prod (1: n);
endif

endfunction
################################################## ################

the graphics are drawn the same way as in the matlab - you need two vectors of the same length, and then just a “plot”
############################
x = linspace (0, 2 * pi, 100);
y = sin (x);
plot (x, y);
############################

PS Read more here: Octave: Getting started

PPS This note was written rather simply to inform that there is a free open source matlab, which basically works almost the same and is almost completely compatible with it. quite a few differences:

1) there is no support for functions in functions
2) there is no support for "object-oriented classes with overloading"
3) there is not a small (very small) number of core functions (gui, dll, java, activex, dde, web, and serial functions), without which you can completely do it for me.
4) it is impossible to compile the code in binaries

*) Some Octave functions are not supported by matlab.
**) In Octave, you can index any object and not just variables.
***) In the octave there are operators "++", "-", "- =", "+ =", "* ="
****) There are differences in the use of double and single quotes for strings
*****) octave renders graphs with GNUPlot

Source: https://habr.com/ru/post/19563/


All Articles