This is my first post, so go easy on me if I've made some mistakes. I'm also not a mathematician, but rather an experimental physicist.
Basically, I have a problem where I need to take the mean of a function given by a sum of two terms, $f(x) = A(x) + B(x)$, and I'm wondering if it makes sense to first take the mean of each term and then sum them, $ \left\langle A(x) \right\rangle + \left\langle B(x) \right\rangle$, or whether I have to take the mean of the entire function, $ \left\langle f(x) \right\rangle$. I get two different results, so I'm guessing one is correct and the other isn't, but I don't understand why that is.
The problem is that the $A(x)$-term does not converge when I try and take the arithmetic mean, so I have to take the harmonic mean of that term instead:
$$ f(x) = \Bigl[ \cos^2 \Bigl( \frac{\pi x}{L}-\frac{\pi}{2} \Bigr) \Bigr]^{-1} + B(x)$$
The second term, $B(x)$, can in principle be any function, so it could be that in certain cases I won't be able to take the arithmetic mean of that term; however, in my case it's simply a constant, $B$:
$$ f(x) = \Bigl[ \cos^2 \Bigl( \frac{\pi x}{L}-\frac{\pi}{2} \Bigr) \Bigr]^{-1} + B$$
When I now take the arithmetic mean of $f(x)$ I get,
$$ \left\langle f \right\rangle = \frac {1}{L^{-1} \int_0^L f^{-1} dx}$$
$$ \left\langle f \right\rangle = \Bigl( \frac{1}{2}-\frac{1}{B} \Bigr)^{-1}$$
However, had I taken the mean of each term and then added them together, $ \left\langle A(x) \right\rangle + \left\langle B(x) \right\rangle$, I will get,
$$ \left\langle A(x) \right\rangle + \left\langle B(x) \right\rangle = 2 + B $$
I'm a bit confused about that. As far as what I understand for means, I should be able to do both and get the same result, no? So why is,
$$ \left\langle f \right\rangle \neq \left\langle A(x) \right\rangle + \left\langle B(x) \right\rangle$$
Am I doing something wrong here? Or is this a property of harmonic means?
Any help would be much appreciated,
Jason