Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ============================================================ | |
// Definition of a variable | |
// ============================================================ | |
const welcome = 'Hello'; | |
console.log(typeof(welcome)); // string | |
// ============================================================ | |
// Types | |
// ============================================================ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ============================================================ | |
# Definition | |
# ============================================================ | |
set([0, 1, 2, 3]) | |
# ============================================================ | |
# Add an item | |
# ============================================================ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ============================================================ | |
// Recursion with one parameter | |
// ============================================================ | |
const factorial = (num) => { | |
if (num === 1) { | |
return 1; | |
} | |
return num * factorial(num - 1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ============================================================ | |
// Simple for loop | |
// ============================================================ | |
int fruits [3] = {1, 2, 3}; | |
for (int i = 0; i < 3; i++) | |
printf("%d\n", fruits[i] * 2); | |
// ============================================================ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ============================================================ | |
# The 3 types of logarithms | |
# ============================================================ | |
x = np.linspace(-3,3,100) | |
ln = np.log(x) | |
decimal = np.log10(x) | |
binary = np.log2(x) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ============================================================ | |
# What is a vector? | |
# ============================================================ | |
scalar = [3] # scalar | |
row = np.array([2,1], dtype=object) # row matrice / vector | |
col = np.array([ [3], [-1] ], dtype=object) # column matrice / vector | |
display(Math(sym.latex(sym.sympify(scalar)))) | |
display(Math(sym.latex(sym.sympify(row)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ============================================================ | |
# Definition of fonction | |
# ============================================================ | |
def area(x): | |
return 2 * x | |
print(area(4)) | |
x = np.linspace(-6,6) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ============================================================ | |
// Without parameter | |
// ============================================================ | |
function double () { | |
console.log('Hello world') | |
} | |
console.log(double()) // Hello world |
NewerOlder