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
// ============================================================ | |
// 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
# ============================================================ | |
# Display of the function | |
# ============================================================ | |
x = np.linspace(-3,3,100) | |
plt.plot(x,np.exp(x)) | |
plt.xlabel('x') | |
plt.ylabel('$e^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
// ============================================================ | |
// 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
# ============================================================ | |
# 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
// ============================================================ | |
// Definition of a variable | |
// ============================================================ | |
const welcome = 'Hello'; | |
console.log(typeof(welcome)); // string | |
// ============================================================ | |
// Types | |
// ============================================================ |
NewerOlder