GNU Octave Part 1 - Big picture
Scientific Programming Language
What’s Octave? According to the website —
- Powerful mathematics-oriented syntax with built-in 2D/3D plotting and visualization tools
- Free software, runs on GNU/Linux, macOS, BSD, and Microsoft Windows
- Drop-in compatible with many Matlab scripts (largely compatible with Matlab)
Download from official website and let’s get started. In this short article we gonna explore what Octave can do.
x = -2:0.5:2;
y = x .^ 2;
title("Simple 2-D Plot");
Beginner note: as soon as you use plot() method, a diagram will appear on GUI, then keep labeling the diagram and it will sync automatically.
x = linspace(-2,2,50);
y = linspace(-2,2,50);
[xx,yy] = meshgrid(x,y);
meshc(xx, yy, 4-(xx .^ 2 + yy .^ 2));
For example, exponent to the multiplication of i and pi
Let a be a simple 2x2 matrix and multiply with A transpose, just like math we can simple write.
A = [1 2; 3 4];
A * A';
Octave has build-in function libraries to enhance programmability, sin() cost() etc. Helper function for quick util like —
lookfor -all "standard deviation";
The package is the bundle of functions providing extra functionality for GNU Octave. Octave Forge is a central location for the development of packages for GNU Octave.
pkg install -forge package_name;
- Semicolon at the end of each statement, will prevent from console out e.g
a = 5;
- It’s dynamic type language, variable copy by value and case sensitive
a = "text";
b = a;
a = 1;% a is 1 now, while b remain as 'text'
- It has both C-like Structures and Python style (mixed)
Solving Systems of Linear Equations, Integrating Differential Equations and more.