What function to use to get geometric mean in trapezoidal rule? When deriving a trapezoidal rule an integral of $f(x)$ is switched to integral of new function $g(x)$ approximating the first one $$\int_a^b {f(x)dx}\approx \int_a^b {g(x)dx}$$ where $g(x)$ is a linear function:
$$g(x)=\frac{f(b)-f(a)}{b-a}(x-a)+f(a)$$
After integration of $g(x)$ one gets trapezoidal rule with arithmetic mean:
$$\int_a^b {f(x)dx}\approx (b-a)\frac{f(a)+f(b)}{2}$$
What function $g(x)$ should I use to get such formula:
$$\int_a^b {f(x)dx}\approx (b-a)\sqrt{f(a)\cdot f(b)}$$
 A: I will assume that $f(a)$ and $f(b)$ are positive, because your formula isn't really adapted for negative values of $f$. Fitting  a quadratic hyperbola (is that a legitimate name?) works. Namely, fit a line to the values $f(a)^{-1/2}$ and $f(b)^{-1/2}$, then raise the equation of the line to power $-2$. The equation is 
$$g(x) = \left(\frac{f(b)^{-1/2}-f(a)^{-1/2}}{b-a}(x-a)+f(a)^{-1/2} \right)^{-2} \tag{1}$$
Let's integrate: 
$$\int_a^b g(x)\,dx =-\frac{b-a}{f(b)^{-1/2}-f(a)^{-1/2}}  \left(\frac{f(b)^{-1/2}-f(a)^{-1/2}}{b-a}(x-a)+f(a)^{-1/2} \right)^{-1}\bigg|_{x=a}^{x=b}$$
Looks ugly, but it simplifies to 
$$-\frac{b-a}{f(b)^{-1/2}-f(a)^{-1/2}}\left(f(b)^{1/2}-f(a)^{1/2} \right) = (b-a)\sqrt{f(a)f(b)}$$
as you wanted. 
By the way, fitting an ordinary hyperbola (i.e., using the exponents $-1$ in (1)) would give you the harmonic mean. 
The idea of raising the given values to some power, interpolating and then applying reciprocal power is occasionally useful: for example, when interpolating in polar coordinates. 
