TITLE: Coend computation continued
QUESTION [9 upvotes]: This is a follow-up question to this coend computation.  Here's an attempt at a slightly simpler computation:

$\int^{a \in A} \mbox{hom}_A(a,a)$

This should be similar to the trace operator.  In attempting to follow the derivation

$\begin{array}{l}\mbox{Set}(\int^{b \in B}\mbox{hom}(a, b) \times F(b), S)\\ \cong \int_b \mbox{Set}(\mbox{hom}(a,b) \times F(b), S)\\ \cong \int_b \mbox{Set}(\mbox{hom}(a,b), \mbox{Set}(F(b), S)) \\ \cong \mbox{Nat}(\mbox{hom}(a,-), \mbox{Set}(F(-), S) \\ \cong \mbox{Set}(F(a), S),\end{array}$ 

I get

$\begin{array}{l}\mbox{Set}(\int^{a \in A} \mbox{hom}_A(a,a), S) \\ \cong \int_{a \in A} \mbox{Set}(\mbox{hom}_A(a,a), S) \\ \cong \mbox{Nat}(\mbox{hom}_A(-,-), S)\end{array}$

So here I guess we have the set of natural transformations from the hom functor to the constant functor $S$.  For any first parameter $a$, we have the set of natural transformations from hom$(a,-)$ to $S(a,-)$, which by Yoneda's lemma is isomorphic to $S(a,a) = S$.  So I think it goes

$\begin{array}{l}\cong \displaystyle \prod_a \mbox{Nat}(\mbox{hom}_A(a,-), S(a,-)) \\ \cong \prod_a S\\ \cong S^{Ob(A)} \\ \cong \mbox{Set}(\mbox{Ob}(A), S).\end{array}$

So $\int^{a \in A} \mbox{hom}_A(a,a) \cong \mbox{Ob}(A).$ Is that right?

REPLY [8 votes]: I agree with Reid's answer, but I want to add a bit more.
Putting Reid's calculation into a more general setting, if $A$ is any category then 
$$
\int^{a \in A} \mathrm{hom}_A (a, a)
= (\mathrm{endomorphisms\ in\ } A)/\sim
$$
where $\sim$ is the (rather nontrivial) equivalence relation generated by $gh \sim hg$ whenever $g$ and $h$ are arrows for which these composites are defined.  
You can see confirmation there that your instinct about traces was right.  If we wanted to define a 'trace map' on the endomorphisms in $A$, it should presumably satisfy $\mathrm{tr}(gh) = \mathrm{tr}(hg)$, i.e. it should factor through $\int^a \mathrm{hom}(a, a)$.
In fact, Simon Willerton has done work on 2-traces in which exactly this coend appears.  See for instance these slides, especially the last one.
You can see in that slide something about the dual formula, the end
$$
\int_{a \in A} \mathrm{hom}_A(a, a).
$$
By the "fundamental fact" I mentioned before, this is the set
$$
{}[A, A](\mathrm{id}, \mathrm{id}) = \mathrm{Nat}(\mathrm{id}, \mathrm{id})
$$
of natural transformations from the identity functor on $A$ to itself.  Evidently this is a monoid, and it's known as the centre of $A$.  For example, when $G$ is a group construed as a one-object category, it's the centre in the sense of group theory.  So your set might, I suppose, be called the co-centre of $A$.