First, let's construct the projections: Clearly, we can map an element $f \in \mathrm{Hom}(\bigoplus_i M_i,\mathbb{R})$ to maps $f_i : M_i\to \mathbb{R}$ by setting $f_i = f\circ \iota_i$, where $\iota_i$ is the inclusion of $M_i$ into the sum.
So this gives projections $\pi_i : f\mapsto f_i$ from the l.h.s. to the factors of the product
@Danu "The purpose of category theory is to show that that which is trivial is indeed trivial" ;)
I've forgotten who said it, but it often rings true
Now, given any other object $N$ with maps $g_i : N\to \mathrm{Hom}(M_i,\mathbb{R})$, we must construct a unique map $g : N\to \mathrm{Hom}(\bigoplus_i M_i,\mathbb{R})$ such that $g_i = \pi_i\circ g$.
The step that most blatantly fails for the roles of sum and product switched is that $m\in\prod_i M_i$ doesn't have finitely many non-zero elements, so the can't form a sum as we did here.
For any $m\in\bigoplus_i M_i$ and every $n\in N$, we set $(g(n))(m) := \sum_{i=1}^n (g_i(n))(m_i)$, so that $n\mapsto g(n)$ is the map for the universal property.
For any $m\in\bigoplus_i M_i$ and every $n\in N$, we set $(g(n))(m) := \sum_{i=1}^n (g_i(n))(m_i)$, so that $n\mapsto g(n)$ is the map for the universal property.
@DavidZ I just spent about 20 minutes fixing syntax errors in a python program which would have been caught be a compiler. Instead, I had to re-run my program over and over, catching one error per iteration.
I suppose this demonstrates that with python tests are more important than with other languages, as one must have the tests exercise code paths even just to find syntax errors.
@0celo7 Let $X_i :=\mathrm{Hom}(M_i,\mathbb{R})$ and $X:=\mathrm{Hom}(\bigoplus M_i,\mathbb{R})$. We must show that for every $N$ with maps $g_i : N\to X_i$ there is a unique map $N\to X$, such that $g_i = \pi_i\circ g$.
Ah, that's another fun game with universal properties, although choosing a basis and just giving explicitly isomorphisms is probably easier for vector spaces
@ACuriousMind Let $A_1=V\otimes W$ and $A_2=V\otimes X$. (more to come)
U.p. of LHS: Given a multilinear map $\mu:V\times(W\oplus X)\to Z$, there is a unique linear map $\tilde \mu:V\otimes(W\oplus X)\to Z$ such that $\mu=\tilde\mu \circ\otimes$.
U.p. of RHS: Given maps $f_k:A_k\to Z$, there is a unique map $f:A_1\oplus A_2\to Z$ such that $f\circ i_k=f_k$.
@0celo7 Begin with the maps $f_k$. We want to show that we get a map $f : V\otimes(W\oplus X)\to Z$ such that $f\circ \iota_k = f_k$.
hm, no, the other direction is better.
@0celo7 Ah, yes: Begin with the $\mu$ and try to construct a map $\mu' : A_1\oplus A_2\to Z$ and a $\otimes' : V\times (W\oplus X)\to A_1\oplus A_2$ with $\mu = \mu'\circ \otimes'$.
The idea for the $\otimes'$ I have already heard from you
We have got the object $A_1\oplus A_2$ and we want to show it's a tensor product. It is part of the u.p. of the tensor product that there is a map called "$\otimes$" from the product of the factors into the tensor product. If $A_1\oplus A_2$ is to be the same as the tensor product, we therefore need a map from the factors into it, and I called that map $\otimes'$.
@0celo7 Sure, but it's just as easy: We need a map $(a_1,a_2) = (v\otimes w + v'\otimes x)\mapsto z$. We only have $\mu$, so we rearrange that data so we can feed it to $\mu$: $\mu'(v\otimes w+ v'\otimes x) := \mu(\frac{1}{2}(v+v'), w+x)$.
@0celo7 In a general element of $A_1\oplus A_2$, the two $V$ in $A_1$ and $A_2$ are completely independent. I chose the simplest expression linear in $v,v'$ that becomes just $v$ when $v=v'$, since that's what we need for $\mu = \mu'\circ \otimes'$.
@0celo7 They are "the obvious maps". If the maps are not obvious to you, that's a very strong sign you don't have the necessary prerequisites, and I honestly don't want to just drag you through every algebraic statement in that book.
The exact formula is $$a_k(x) = \frac{1}{\sqrt{(2\pi)^n 2 \omega_k}} \int d^n x e^{ikx} (\omega_k \varphi(x) + \frac{\delta}{\delta \varphi(x)} - \varphi(x))$$