skip to content
← Go back

Calculus

Foreword

Started 14/06/2024

We have 2 goals in calculus:

  1. Find the tangent to the curve at a point
  2. Find the area under the curve between two points

Why do we give a shit? In AI we use

  1. The tangent to find the local/global max/min. We create a 2nd point on the curve which creates a secant. We move this second point towards the 1st point until we get a tangent, essentially ΔyΔx=0\dfrac{\Delta y}{\Delta x} = 0 bc 0 means horizontally flat.
  2. The area is used to assess whether this was an improvement or not. If you found a new tangent that is 0 / horizontally flat the area is what will indicate whether you’ve improved — the smaller the area for a minima the better performance you have.

Limits

The whole point of limits is to get infinitely close to a point without being the point, e.g. lim01\lim_{0 \to 1}. Then when you’re infinitely close to 1 you have your secent will become the tangent.

We can think of the limit

lim01=slopesecant1\lim_{0 \to 1} = \text{slope}_{secant \to 1}

And when the secant is making the jump from 0.99.. it becomes a tangent, not longer being a limit

slope mtangent=1\text{slope } m_{tangent} = 1

The function must approach from the left and right for the limit to exist.

Differentials

d means a lil bit of, e.g, dxdx means a lil bit of x. If x = 10 then dx=0.01dx = 0.01, we call this a differential. And this “small bit” is infinitely small so when you multiple it by itself dxdx=(dx)2dx \cdot dx = (dx)^2 it is virtually 0.

We can think of dx as the change in x when we’re observing the rate of change, e.g. x+dxx + dx or x+Δxx + \Delta x where Δ\Delta means the change.

Sometimes ϕ\phi (“phi”) is used instead of f in f(x)y=ϕ(x)y = \phi(x)

The ratio dydx\dfrac{dy}{dx} is the “differential coefficient of y with respect to x” which tells us how much of y is changing relative to x. “Differentiating” is the process of finding dydx\dfrac{dy}{dx}.

We can think of dydx\dfrac{dy}{dx} as small bit of ysmall bit of y\dfrac{\text{small bit of y}}{\text{small bit of y}}, not dydx\dfrac{d \cdot y}{d \cdot x}

If we see something like

f(x)f''(x)

then the accents ' mean the function has differentiated with respect to x once. Two accents '' means it’s been differentiated twice.

The aim of differentiation is to find the ratio of growth, of for example y relative to x.

Integrals

Integrals are opposite of differentials by summing all of the little pieces together.

\int

So we can find all the little pieces of x w/ the notation

dx\int dx

Composite Functions

Combining two or more functions is called the “composition of functions”. Combining funcitons allows us to expand the range of causality.

E.g.,

xff(x)gg(f(x))x \to f \to f(x) \to g \to g(f(x))

Relative Error

The relative error gives the ratio of the difference between the values of f(x) and g(x) to the variation of x when x is changed.

We use this in AI to change model’s inputs to get closer to perfecting the action. If we’re playing basketball and miss a shot this calculates how far did we miss in all directions and how much to adjust by in the dimensions that matter.

Relative error =Difference between f(x) and g(x)Change of x\text{Relative error } = \dfrac{\text{Difference between } f(x) \text{ and } g(x)}{\text{Change of }x}

Where,

  • f(x) is our original fn — lets say in the basketball hoop
  • g(x) is our approximating fn — our shot to throw in the hoop

Limits

We use ϵ\epsilon to represent small quantities and to obtain a derivative.

Limits, represented as limx0f(x)\lim_{x \to 0} f(x), are used to represent the value a function as the input approaches a value. So for the epression x is the closest it can be to 0 without being 0.

We can calculate the derivative of linear function with the approximate function of f(x)f(x). k is called teh differential coefficient of f(x) at x = a.

We can find the derivative via the difference quotient w/ f'(x) where we call it “f-prime”.

f(a)=slope k=limϵ0f(a+ϵ)f(a)ϵf'(a) = \text{slope } k = \lim_{\epsilon \to 0} \dfrac{f(a + \epsilon) - f(a)}{\epsilon}

The derivative of f(x) is f′(x) = 0. This makes sense, since our function is constant—the rate of change is 0