432 points · by TheNumbat · 3y ago · 120 comments
Another fantastic application that the website doesn't mention is the composition / Koopman operator. In control theory (e.g. autonomous drones, cars, robot arms, etc.), most real-world systems are described by nonlinear dynamics which are very difficult to work with (e.g. safety/stability guarantees, optimizing over forward horizons using NMPC, state estimation, etc.) The Koopman operator however gives a globally relevant linear approximation of non-linear systems. In other words, you can treat a nonlinear system as a linear system with fairly high accuracy. This greatly simplifies control and estimation from a computational perspective. You can also learn these linearizations from data. Steve Brunton has some good materials on Koopman theory [2][3], and there are some great applications to control of systems such as soft robots [4].
[1]: https://arxiv.org/abs/1904.02539
[2]: https://youtube.com/playlist?list=PLMrJAkhIeNNSVXUvppZTYNHKQ...
Solid YouTube educators are creating immense future opportunities and we'll all benefit from that. Control theory connects the dots between all sorts of things and can be a joy for those of us who love seeing patterns and structures everywhere (iirc Steve has a recent video about control theory for social models also).
The significance of this paradigm shift is that it allowed mathematicians to apply some of the geometric intuition developed from the study of finite-dimensional spaces (such as the 3D Euclidean space) to difficult questions involving functions, such as the existence of solutions to certain differential equations.
The history of this change of perspective is absolutely fascinating and can be traced back to the end of the 19th century and beginning of the 20th century. At the time, work on axiomatic foundations of mathematics was driving a systematization of the study of mathematical objects by capturing their structure with a concise list of axioms. This is for example how the concept of an abstract vector space was born, encompassing not only Euclidean spaces but also infinite-dimensional spaces of functions.
An early reference already demonstrating this change of perspective, albeit in a primitive form, is a memoir by Vito Volterra from 1889 [1]. The PhD thesis of Maurice Fréchet from 1906 [2] is arguably the work that was most influential in crystalizing the new paradigm and presenting it in a modern form that served as a key reference for the first half of the 19th century. Of course, these are only two among a multitude of works around that time. Looking at later developments in the 19th century, it is hard not to also mention the book by Stefan Banach from 1932 [3].
[1] https://projecteuclid.org/journals/acta-mathematica/volume-1...
[2] https://zenodo.org/record/1428464/files/article.pdf
[3] http://kielich.amu.edu.pl/Stefan_Banach/pdf/teoria-operacji-...
Perhaps the most famous example is provided by the Lp spaces [1] consisting of functions whose pth power is absolutely integrable. For p≥1, these spaces are Banach spaces (complete normed spaces) but it is only when p=2 that the norm is associated with an inner product.
Even Hilbert spaces are usually just indexed by the ints. And such a basis gives you zero continuity or differential conditions. All the functional analysis I have seen uses some continuity conditions and has some countable basis. Other than that, it is a very useful perspective on functions, and kind of the required start to understanding quantum mechanics formalism.
The article (maybe for good reason) completely ignores the (usually quite hard) choice in functional analysis which vectorspace to use.
And the one outlined here, where functions are defined pointwise, is amost always the most useless one to consider. Although I get that it was done to teach the general outline of the subject, which is quite valuable on its own.
>Clearly there is no Fourier transformation possible on all functions?
You don't even get a useful metric for such a space.
Function spaces can’t always be viewed as vector spaces because there may be no concept of addition of functions or a concept of scalar multiplication on the functions that behaves well with whatever notion of addition the functions satisfy.
> A function f from a set X to a set Y, denoted f: X -> Y, is a relation from X, the domain, to Y, the co-domain, that satisfies two properties: (1) every element in X is related to some element in Y, and (2) no element in X is related to more than one element in Y.
Susanna S. Epp. 2010. Discrete Mathematics with Applications (4th. ed.). p.384
You could make it a function by defining sqrt : N -> Z×Z, so sqrt(4) = (-2,2), and we're back to the property that any value in the domain (the natural numbers) is mapped to a single value in the co-domain (a unique pair of integers). Of course, this is not the traditional sqrt function that people normally use, since it doesn't obey the property (sqrt(x))² = x (since obviously taking the square of a pair of integers will not return an integer, for usual definitions of squaring).
Note that a bijective function has both this property and the opposite, that for any value in the co-domain there is also a unique value in the domain that maps to it. Sqrt, both in the traditional definition where it only returns positive roots, and in this definition where it returns a pair of roots, is actually also bijective. Squaring is a non-bijective function, though.
sqrt: C -> (C×C)/~,
where C is the complex numbers and ~ is the equivalence relation generated by (a,b) ~ (b,a) for all a,b in C.
Any claims of injective or surjective properties (and by extension bijection) are moot without the domain and co-domain being specified.
To map math ↦ dev semantics: functions need to be pure, deterministic and declared with strong types. The properties of square root in particular will vary wildly based on what those types are.
1. When we want to consider both positive and negative square roots, we can just say that instead of the function sqrt(x): ℝ ⟶ ℝ which always gives a nonnegative real number, we are using a function full_sqrt(x): ℝ ⟶ ℝ² which gives an ordered pair of real numbers.
2. We mostly define arcsine as yielding a single value between -pi/2 and pi/2, but it's just as easy to define the equivalence relation "x ~ y when sin(x) = sin(y)" and then say that the unique value given by the arcsine function is one of the equivalence classes which that relation induces over the real numbers -- or that it is the subset of the reals included in such an equivalence class.
3. If we are concerned about graphing a multi-valued function, we can do that too; for your parabola, we can define the three-dimensional function "z(x,y): ℝ² ⟶ {0, 1} = 1 when x = y² and 0 otherwise" and the graph of this function is the parabola you want.
So you're wrong about the definition of a function, except that you're right in spirit; the way we normally think about functions, as opposed to the way we define them, definitely allows them to yield multiple values for one input.
You're catastrophically wrong about bijective functions; those are an important concept and your definition is not related to the actual one. A bijective function is one for which all values in the target set are reached by exactly one, no more and no less, value in the source set.
Isn’t the function definition meant to be interpreted as “maps consistently to exactly one element of the codomain”? So an ordered pair of R^2 is still one element of R^2
It seems the parent has just mixed up the domain and codomain, because under that assumption he would be right about both the definition and bijectivity
Yes, nothing stops you from defining the square root function such that it returns an element of R^2. It's perfectly legal mathematics, functions can map arbitrary domains to arbitrary codomains after all.
But I've never seen it used anywhere. Maybe there is an area where such a definition makes sense... but regular real (or complex) analysis doesn't really normally do such a kind of thing.
The problem is that you want your typical functions like square root (and logarithms, which in the complex case also aren't unique) to be functions R -> R (or C -> C). Otherwise you can't compose them and then everything is kinda weird. In particular, you don't get the vector space structure that the article is all about.
When working in a structure, one often doesn't want to leave that structure and go to another one, but keep the same structure (or at least one that is related in an interesting way, such as a quotient structure). That just leads to more interesting mathematics.
I will say that as a programmer some of these techniques look a lot like hacks. You start off with a perfectly reasonable integer index. And then you realize you can generalize the index, effectively cramming more information into the index than was originally intended. The really shocking thing is that these stupid, abusive ideas seem to always lead to something really insightful and useful down the road. It's a little bit magical.
Paper: "Functional Tensors for Probabilistic Programming" (2019) https://arxiv.org/abs/1910.10775
So the idea is that if you two functions, f and g, and a scalar b, then you can do stuff like:
f + g = g + f
b(f + g) = bf + bg
The existence of (-f) so you have:
f + (-f) = 0
Where 0 is the zero function (which also must exist for function spaces).
I was reading here earlier today about the naming of the constant for light as c, and I had a question which I was too embarrassed to ask. It is this: In e=mc^2, what are the units, and if the units aren't defined and it's just a relationship, then why specify c^2? What's the point of squaring a constant, since it's just another constant?
Not that I understand a damn thing about that equation. But the idea that two functions can be thought of operating additively on a vector - or space - seems... trivial.
This is where I fear I am too stupid to understand the value of this.
Consider otherwise functions which take colours and output letters or the alphabet. Letters of the alphabet can't be added or subtracted, so there's no vector space structure on that.
On the flip side, vector spaces can be defined not just on real numbers, but complex numbers as well, or even other sets — specifically, any "field", that is, any set with addition, subtraction, multiplication, and division defined on it in a self-consistent way. There are even finite fields; vector spaces over three are relevant in cryptography.
If these rules seem silly and abstract to you (shouldn't a function just be a function?!), well, that's mathematics! By elucidating the very specific conditions under which results hold, and abstracting away all the irrelevant details, you end up with results of incredible generality.
No, the functions are not operating on a vector, the functions themselves are vectors, which means you can do things like define a linear transformation L and then you have things like this:
L(af + bg) = aL(f) + bL(g)
You may also define a norm on a function space (such as an L^P space [1]), ||f||_p, which maps functions to non-negative real numbers and obeys the properties of norms that we expect, such as the triangle inequality:
||f + g||_p <= ||f||_p + ||g||_p
- c: speed of light in meters per second
- m: mass in kilograms
- energy: joules
However, there's something that has been bothering me: most of my understanding of linear algebra comes from 2D and 3D spaces, and then in different context of machine learning, datasets that have from tens to even millions of dimensions.
In the former, geometric context, the connection between the dimensions are clear: they are orthogonal, but conceptually exactly similar. They are just a 90 degree rotation away from each other.
On the other hand, in ML datasets some dimensions are conceptually very similar, and some are totally different. Some are correlated (nearby pixels of an image), some are not, but represent the same unit of quality, and some represent totally different, unrelated things. And as we go toward the mid-layer representations, it becomes very unclear and fuzzy what they represent.
In the case of functions, there's usually a clear connection between the dimensions: they are of the same unit (the domain and the image (the outputs and inputs) of the function are sets, and those tend to be made of similar-ish – or same type of – things, at least in well-behaved math). And there's often a similarity metric between the elements of the sets.
The 2D/3D linear algebra that I know doesn't bother with the "connectedness" of the input dimensions; it only cares the connections from the inputs to the outputs. But surely there is a lot of interesting math that is concerned with the connectedness of the input and output spaces themselves, in context of there still existing a mapping between the input and output. What is that field of math called? What are the interesting results, theorems and such? I love learning more so I'm kind of just looking for some pointers/keywords.
As a concrete example, I am toying with a reinforcement learning to solve the game of Yahtzee. When trying to formulate the state space, I have to lump in together the states of the dice (1..6), the current state of the score card (13 boolean values, and 13 integer scores in the range 0..50), and the current turn (first attempt, second attempt). This could be formulated as a 5+13+13+2 = 34 dimensional vector, but I might as well use one-hot encoding for some aspects, and even go all the way up to 56+13+56+13+30+30+1+1+1+1+30 = 180 dimensions. Which formulation would be the most "natural"?
Then again, what may seem (un)natural to a human, might be the other way around for a neural network.
(And, yes, I am aware of papers out there describing how to solve Yahtzee with reinforcement learning, but I'm still at a stage where avoiding those seems to increase the amount of fun.)
For example, for the current state of a rolled die in Yahtzee, ‘2’ mostly (see below) isn’t smaller than ‘3’, isn’t between ‘1’ and ‘3’, and isn’t closer to ‘3’ than it is to ‘4’.
So, ‘2’ isn’t a quantity there; it’s just one of the markings on the dice.
About that ‘mostly’: the straights require the ability to order the values on the dice, but even then, it’s just an order, not anything about them being equidistant, or about (2,6) showing more eyes than (3,4) (again, there’s an exception there, with the ‘Chance’ score)
BTW: There’s usually an infinite number of solutions to a differential equation, and IIRC (it’s been a while) those solutions too form a vector space.
Topology.
Topology studies neighborhoods in your space and how they relate to things like functions, limits, etc.
Since you brought up images:
https://en.wikipedia.org/wiki/Digital_topology
And data science:
Thanks for the links!! Much appreciated.
Traditionally, in regression analysis, you'd use dummy variables for the nominal/binary data, turning all of them into binary {0, 1}. This is GF(2), a bonified vector space. Education level you've got some choices. You can also encode these as binary, potentially losing some information given they're ordered. But if you choose to map them to integers or real numbers, what is the justification for the distance function you're defining? Is MD > PhD? How much greater is PhD than BA than high school diploma?
If you stick to one-hot encoding, there's justification in performing regression analysis still, because you end up in a case where most of the values are 0 and drop out and you get multiple models, one for each case, so the matrix operations being performed to generate the model only operate on the remaining real-valued vectors, and the one case that is 1 becomes the constant term. This is just basic ANCOVA.
You have another issue, though, right? Are "height" and "income" and "age" really from the same vector space? Obviously not. Some modelers choose to ignore this. Some will assume they're all normally distributed and tranform the individual values to a Z-score or something and then they're all from the same vector space. But this still may be dubious. For one thing, they're not actually normally distributed. Height and age have a strictly zero lower-bound. They have some upper-bound, whatever it may be. Income is severely right-skewed. But they're probably all at least approximately normal over some restricted range of the most common values.
We're starting to see the issue. Modeling in this way might work reasonably well within some restricted range of common values, but extreme cases are left out. We need some other techniques that don't rely on matrix math, because once we have to admit all of our elements from not from the same field, we admit we don't really have a matrix, even if a computer will gladly let us pretend anything we can encode as a number is actually a number.
I think your question is how can we encode data such that it all ends up in the same vector space? It's easy if your data is imagery. Color channel intensity of each pixel is all real-valued, possibly within different ranges, but easily normed. If all you have is text, representing the corpus by an incidence matrix puts all of your elements in GF(2). Plenty of other word embeddings are well-justified. But when you start looking at longitudinal data from epidemology, the shit they do in econometrics, it starts to get less math and more black magic. By the time you're a data scientist at Netflix, I'm sure they have reason to believe whatever they're doing works, but it may be hard to reason about why it works.
I don't really know if there any field of mathematics studying ways of encoding data such that doing things like adding and multipying height by favorite color actually means anything, but it's an interesting question.
No, it's not. Yes, that is an example of a single question we could ask when doing work in that context. My question was:
> What is that field of math called? What are the interesting results, theorems and such? I love learning more so I'm kind of just looking for some pointers/keywords.
f + g = g + f
f + (g + h) = (f + g) + h
f + -f = 0
(a * b) * f = a * bf
a
(f + g) = af + ag(a + b) * f = af + bf
“AND” is 0001 for 00 01 10 11. 2^4=16 binary Boolean functions, in ternary it blows up, but it’s not infinite.
Take a vector for normal space, [x, y, z]. We say each component of this vector is one dimension, so this one is 3D, and each of its three components can vary. Two such vectors are different if one or more components differ between them. Treating a function as a vector means treating each distinct possible input to the function as a distinct component.
For example, consider the integer function f(x) = x^2. This can be represented as the vector [..., 16, 9, 4, 0, 4, 9, 16, ...] Where the complete vector has as many components as integers. Since there's infinitely many integers, there's infinite components, so instead of 3D like the three component vector above, this vector is ∞D.
Any single function is representable in this way, so each distinct function has its own unique infinitely long vector.
So each different function is a different "point" in an infinite dimensional vector space.
That vector describes a single point in an infinite-dimensional space. Thus every function from R to R is a single point in an infinite-dimensional space.
Now you can use linear algebra to move these points around in the infinite-dimensional space, measure how far two points [functions] are from each other, etc. That's functional analysis.
The linear operators that do this moving around and measuring are called functionals to indicate that they take functions as arguments. (Like higher-order functions in a programming language.) "Functional Analysis" is thus "The analysis of the objects known as functionals".
Differentiation is an example of a functional.
And that is just the first howler. This person never bothered to learn the subject they are expounding on.
Not really grokking this. Seems to come out of nowhere.
e.g.
float vector[4]{1.0, 5.0, 3.0, 2.5};
vector[0] == 1.0;
vector[1] == 5.0;
vector[2] == 3.0;
vector[3] == 2.5;
You process the operations between such equations -sum, inner, outer- by "unpacking" them into Matrix equations format (populating the Matrix with the vector values), doing the operations, and returning back to the vector format.
So in essence you are working with Matrix equations, but with a more compact format as vector.
For being able to work with such equations' compact format, its needed to follow some rules restricted to the purpose, case contrary, as in reality they are vectors per se, the geometries could mix dimensions were the equations' proprieties are different.
The problem is many real world functions and problems are nonlinear. But they may have linear components. For example, a dog can be recognized by its outline and the texture of the fur, pattern of the face, etc within that outline. Deep neural nets solve this by composing vector operations, hence the universal approximation theorem and existence of NNs that can recognize dogs (though I could have picked a better example as dog recognition is not continuous I think).
In the context of computer programming, it is not really a helpful statement to say that functions are vectors. But because of the universal approximation theorem and its relatives you could say that “functions are (can be approximated as) compositions of vector operations”
The author studied at CMU, where the proudly-paraded slogan for an introductory functional programming classes is "Functions are values", which has an almost cult-like status - appearing on their TA hoodies, laptop stickers, and so on.
Other classes soon caught on, first with the imperative programming class declaring that "Functions are pointers", then the introductory discrete math class's "Functions are tuples", and even "Functions are relations" from the databases class.
So viewed in this lens, passing up the opportunity to title it what it was would have been unthinkable.