« first day (3154 days earlier)   

1:06 AM
Wasted an hour on my linear algebra homework before the realization that matrix dot product isn't commutative :/
 
1:23 AM
matrix dot product?
Do you mean an inner product or composition?
If the matrices are over R then their inner product should be commutative
 
I mean the literal . in Mathematica I don't know the technical term
 
It is probably composition.
 
My professor's accent is completely incomprehensible, I'm basically self-taught
 
Often called multiplication (I think this term is bad though)
If you think of matrices as linear functions of vectors (which you should be), then matrix "multiplciation" is just function composition.
 
That's exactly what I'm doing now
I just composed the functions backwards
Are you wheat wizard btw
 
1:33 AM
Which transforms it from a bizarre seemingly arbitrary operation to a meaningful term.
I be them
 
I have no clue how I guessed that, this is the first time I'm seeing this username/pfp
 
Highish rep + unfamiliar name = wheat wizard
 
Yeah :D
I wonder if there's a language out there that overrides multiplication on functions to compose them
 
I think Haskell may
Oh It probably ends up on (<>) instead
 
The impression I got from my little Haskell knowledge is that it doesn't override anything ever
 
1:43 AM
How did you get that impression?
 
@Pavel You almost can in JS :P
 
It is actually overloaded in Haskell
at least in the Numeric.LinearAlgebra package
 
@SriotchilismO'Zaic Maybe I just read something wrong and it's been a while ¯\_(ツ)_/¯
 
Well for the most part Haskell uses a lot of type classes which abstractions quite nice.
 
I thought that (*) had to have type Num -> Num -> Num and you couldn't do much about that
 
1:47 AM
It has type Num a => a -> a -> a
 
My point that type a -> b is not Num stands
 
Ah but, (Container Matrix a, Num a, Num (Vector a)) => Num (Matrix a)
That is, a matrix of things that are Nums is itself a Num.
 
Oh, so you still meant actual matrices and not just functions
 
Oh yes I did.
 
Also, your blob of a type just completely lost me
 
1:50 AM
Yeah it is easier to break it up
the first one Container Matrix a is just fluff and only very technically neccessary
Then next one is Num a or in english a is a Num,
 
and a is a Vector, and a Vector is a Num?
 
Not quite
Num (Vector a) means a Vector of as is a Num.
 
Ah
So is this also defining the Vector type at the same time?
 
It is not
that is defined elsewhere
 
But you can still give it additional is-a relationships from within a different type definition???
 
1:53 AM
This is actually an instance declaration so it doesn't define any types, it just gives the compiler a template for making certain types.
 
Like a generic type in other languages?
 
@Pavel Thinks on the left hand side are preconditions, that is they are things required to be true for the right hand side to be true.
@Pavel Roughly speaking yes
 
Ah, got it. The precondition explanation clears it up a lot
If a is a Num, and a Vector of as is a Num, then a Matrix of as is also a Num
 
Yes
You could write an instance declaration of function composition as *.
I think
 
Now because the definition of (*) is (Num a) => a -> a -> a, all those as have to be the same, so you couldn't, for example, override multiplication to multiply a matrix and a scalar?
 
1:59 AM
Oh I misunderstood
@Pavel Yes you cannot get scalar "multiplication" with (*) from Num
This is because Num is actually representative of a structure called a ring in algebra, and scalar multiplication is not a ring
In fact I don't like calling scalar multiplication "multiplication" because I think it is misleading, but it is the prevailing term.
 
It's actually mapping scalar * scalar multiplication over a 2D array. There's probably a name for this.
 
It can be thought of a little more generally than that.
If a matrix is a linear function, It is multiplying the result of that function by some value
 
So for matrix A * scalar s, we can think of scalar multiplication as the composition of (s*) and A
 
Yes
Importantly this allows us to do it over black box functions.
 
ooh
 
2:07 AM
It also might be a neat exercise to prove that this is the case.
 
So what branch of mathematics is this?
 

« first day (3154 days earlier)