Δ calc (delta calc) is traditional calculus. In the School of Tomorrow, we abet Δ calc with λ calc (lambda calc), which we've expanded to mean "computer science" (roughly) or "discrete mathematics".
Discrete math approaches calculus as we boost the frequency i.e. as the frame rate increases to appear "smoothly continuous".
from typing import Callable
import numpy
def D(f: Callable) -> Callable:
"""
return a deriviative function
"""
def Df(x: float, h=1e-8) -> float:
return (f(x + h) - f(x))/h
return Df
def parabola(x: float) -> float:
"The classic calculus function, no?"
return x * x # or x**2 -- don't have to say 'squared' in SoT
from matplotlib import pyplot as plt # we're gonna plot
from numpy import linspace, vectorize
linspace
and arange
will be commonly used, if the curriculum is at all numpy-enabled.
domain = linspace(-10, 10, 100) # nice domain of 100 points exactly
Well want to disambiguate the "vector" as:
a kind of storage unit or data recepticle, with "vectorized" operations happening in parallel or independently to each cell or element.
the other kind of "vector" lives in a mathematical "vector space" as an element define to add with other vectors.
Below, we "vectorize" the parabola function (per definition 1) so as to apply it to our domain without any need for explicit for-loop syntax.
y = vectorize(parabola)(domain)
fig = plt.figure()
plt.plot(domain,y)
fig.suptitle('Parabola', fontsize=20)
plt.xlabel('x', fontsize=18)
plt.ylabel('y', fontsize=16)
Text(0, 0.5, 'y')
deriv = D(parabola)
dy = vectorize(deriv)(domain)
fig = plt.figure()
fig.suptitle('Parabola', fontsize=20)
plt.xlabel('x', fontsize=18)
plt.ylabel('y', fontsize=16)
plt.plot(domain,y, label="y")
plt.plot(domain,dy, label="dy/dx")
plt.legend();
Still using a graphing calculator?
Switch today!
Use the Calculator of Tomorrow.
from IPython.display import YouTubeVideo
YouTubeVideo("eTDH7m4vEiM")