|
|
|
|
|
by westurner
786 days ago
|
|
Multiplication is repeated Addition. Exponentiation is repeated Multiplication. assert 2+3 == 5
assert 2*3 == 6 == 2 + 2 + 2
assert 2**3 == 8 == ((2+2) + (2+2))
And then fractional countability; assert 2.5*2 == 5 == (2*2) + (0.5*2)
assert 2.5*10 == 25
assert 2.5*100 == 250
assert 2.5*104 == 260 == (2.5*100)+(2.5*4)
Functions are quickly demo'able with Desmos or Geogebra, or SymPy and matplotlib: # f(x) = x+1
def f(x):
return x+1
assert f(0) == 1
assert f(1) == 2
assert f(999) == 1000
Calculus derivatives: # N-th derivatives of displacement; velocity, acceleration, jerk, jounce
# (time t seconds, meters)
xyvals = [(0,0), (1, 10), (2, 120)]
# velocity:
10-0 / 1-0 = 10m/s
100-10 / 2-1 = 110m/s
|
|