TITLE: Explicit formula for the trace of an unramified principal series representation of $GL(n,K)$, $K$ $p$-adic.
QUESTION [18 upvotes]: Let $K$ be a non-arch local field (I'm only interested in the char 0 case), let $\mathbb{G}$ be a connected reductive group over $K$ and let $G=\mathbb{G}(K)$. If $V$ is a smooth irreducible complex representation of $G$ and if $H$ is the Hecke algebra of locally constant complex-valued functions on $G$ with compact support (fix a Haar measure on $G$ to make $H$ an algebra under convolution), then $V$ is naturally an $H$-module, and every $h\in H$ acts on $V$ via a finite rank operator and hence has a trace.
It is my understanding that in this connected reductive situation, a theorem of Harish-Chandra says that this trace function $t:H\to\mathbb{C}$ can actually be expressed as
$$t(h)=\int_G tr(g)h(g) dg$$
for $tr:G\to\mathbb{C}$ an $L^1$ function, called the trace of $V$.
If $V$ is finite-dimensional then $tr$ is the usual trace. However I realised earlier this week that I do not know one single explicit example of this function if $V$ is infinite-dimensional. I just spent 20 minutes trying to fathom out what I guessed was probably the simplest non-trivial example: if $G=GL(2,K)$ and $V$ is, say, an unramified principal series representation. I failed :-( I could compute the trace of $h$ for various explicit $h$ (typically supported in $GL(2,R)$, $R$ the integers of $K$) but this didn't seem to get me any closer to an actual formula: in particular, although I could figure out $t$ on various functions I couldn't figure out $tr$ on any elements of $G$. On the other hand I imagine that this sort of stuff is completely standard, if you know where to look.
If $\mu_1$ and $\mu_2$ are unramified characters of $K^\times$ and $V$ is the associated principal series representation of $GL(2,K)$, then what is $tr(g)$ for $g$, say, a diagonal matrix? Or $g$ a unipotent matrix? 
[EDIT: Alexander Braverman points out that I have over-stated Harish-Chandra's result: $t$ is only locally $L^1$. Furthermore one has to be a little careful---more careful than I was at least---because $t$ is only defined via some integrals so one could change it on a set of measure zero---hence in some sense asking to evaluate $t$ at an explicit point makes no sense. However he, in his answer, shows how to make sense of my question anyway, as well as answering it.]
[EDIT: Loren Spice points out that my paranthetical char 0 comment is actually an assumption in Harish-Chandra's result, and that apparently local integrability is still open in char $p$. I didn't make a very good job of stating H-C's theorem at all!]

REPLY [2 votes]: I am not sure, if you are still interested in this, but here is the general computation: 
Let $\phi \in C_c^\infty (GL_n(F))$, and let $\pi$ be a super-cuspidal representation of a Levi subgroup $M$ of a parabolic $P$ with unipotent radical $N$, and let $\pi_0 = Ind_{P}^{GL_n(F)} \pi$ be the normalized induced representation (assume unitary, irreducible for safety). Let $K$ be compact open subgroup with $GL_n(F) = P K$. 

Define $ \phi^K (x) = \int\limits_K \phi(k^{-1}xk)  d k,$
Define $ A\phi^K(m) = \Delta_P(m)^{1/2} \int\limits_{N} \phi^K(mn)d n$  for $m \in M$
Then we have that $A\phi^K \in C_c^\infty(M)$ and the formula
$$ tr \pi_0(\phi) = tr \pi( A \phi^K).$$

The same formula is also useful, if the representation is not irreducible (unitarizability is not really an issue, and admissibility follows from the Iwasawa decomposition), but one has to normalize and decompose according to the $K$-isotypes.
So in your situation, you get a Fourier transform of $A \phi^K$. This in addition with Moshe Adrian answer computes all the irreducible, unitary principal series representation, at least in prinicple.