Skip to content

Instantly share code, notes, and snippets.

# @pip numpy
import numpy as np
print(np.array([1, 2, 3]) * 2);
import math
def get_e():
n = 10000
return math.pow(1 + (1 / n), n)
print(get_e())
import math
print(math.log(1, 10))
print(math.log(10, 10))
print(math.log(100, 10))
print(math.log(1, 2))
print(math.log(2, 2))
print(math.log(4, 2))
import math
def log_plus(a, b):
print(f'{math.log(a, 10)} + {math.log(b, 10)} = {math.log(a * b, 10)}')
log_plus(2, 2)
log_plus(2, 3)
log_plus(5, 10)
import math
print(math.cos(math.radians(0)))
print(math.cos(math.radians(90)))
print(math.sin(math.radians(0)))
print(math.sin(math.radians(90)))
import math
for i in range(0, 360+10, 10):
cos = math.cos(math.radians(i))
sin = math.sin(math.radians(i))
print(i, cos, sin)