Help factorising functions



Hi,

I'm sure this is straightforward enough yet I've not managed to work out 
how to do it so far from the documentation.

I have several functions of several variables, for instance, f(x, y, z) 
which I know can be written in the following form:

f(x, y, z) = g1(y, z) * h1(x) + g2(y, z) * h2(x) + g3(y, z) * h3(x)

where h1(x), h2(x) and h3(x) are known. How to get maxima to produce 
g1(y, z), g2(y, z) and g3(y, z)?

For instance

f(x, mu, gamma): (- gamma * (x-mu)**2 - log(gamma) + log(2*%pi)) / 2

So how can I ask maxima to decompose f as:

g1(mu, gamma) * x**2 + g2(mu, gamma) * x + g3(mu, gamma)

and

g1(x, gamma) * mu**2 + g2(x, gamma) * mu + g3(x, gamma)

and

g1(x, mu) * log(gamma) + g2(x, mu) * gamma + g3(x, mu)

Thanks in advance,
John.