S2 Tutorials

Here is a list of tutorials.

The toggles are working. Please, note, that you have to add a template to the library in order to be able to display it inside the toggles.

Video Tutorials

Introduction to S2​
S2 and Kotlin
Linear Algebra

Introduction to the S2 System​

S2 is the latest cutting-edge data science platform which enables you to code up any math algorithms. It solves a number existing problems that most Python users face such as deployment and performance. S2 is much faster than MATLAB/R. S2 is a Java based technology. You write once and it runs everywhere. S2 uses Kotlin. It is easy and pleasant to learn. We provide a lot of examples for you to learn from linear algebra to optimization to statistics and so on and so forth.


To start, please go to this link https://s2.nm.dev/ to register for a free account. Click the register button and fill out the information.

This is what the S2 IDE (Integrated development environment) looks like. Let’s start with the 1+1, just to make sure things work. With 1+1 working, we can do pretty much anything in numerical programming, which is just a more complicated series of many 1+1.

Basic Kotlin​

Let’s first learn some basic commands to get familiar with Katlin which is an open-source statically typed programming language that runs on Java Virtual Machine (JVM). 

Kotlin Variable

Variables are used to store data to be manipulated and referenced in the program. It is fundamentally a unit of storing data and labeling it waits for an expository alias so that the program is simple to read and easy to understand. In other words, we can say that variables are the containers to collect information.

In Kotlin, all the variables should be declared. However, if any variable is not declared, then it pops out to be a syntax error. Also, the declaration of the variable determines the type of data we are allowing to store in the variable. In Kotlin, variables can be defined using val and var keywords.

Let see how var and val keywords are different from each other.

Var :

Var is like a generic variable used in any programming language that can be utilized multiple times in a single program. Moreover, you can change its value anytime in a program. Therefore, it is known as the mutable variable.

Here is an example of mutable variable in Kotlin:

var num1 = 10
Var num2 = 20
Num1 = 20
println(num1 + num2) // output : 40

Here the value of num1 that is 20, is overwritten by the previous value of num1 that is 10. Therefore the output of num1 + num2 is 40 instead of 30.


Val is like a constant variable, and you cannot change its value later in the program, which neither can be assigned multiple times in a single program and can be used only once in a particular program. Ergo, it is known as an immutable variable.

Here is an Kotlin program example of immutable variables in Kotlin:

Val num1 = 10
Var num2 = 20

Here, the value of num1 that is 10 cannot be overwritten by the new value of num1 that is 20, as it is of val type that is constant. Therefore, the output is 30 instead of 40.

Note: In Kotlin, immutable variables are preferred over mutable variables.