Integral of $\ln f(x)$

10k Views Asked by At

I know that $\displaystyle\int\ln(f(x))dx=x\ln(f(x))-\int\frac{xf'(x)}{f(x)}dx$ which seemingly cannot be further compacted (i.e. it requires to know $f$). In my problem $f$ is (pretty well form) as follows:

$$f(x)=c+d(1-\frac{\cosh\frac{x}{a}}{\cosh\frac{b}{2a}})$$

for $\displaystyle-\frac{b}{2}<x<\frac{b}{2}$. I'm struggling to obtain a compact solution for $$\int_{-\frac{b}{2}}^{\frac{b}{2}}\ln(f(x))dx$$

In fact, the second term ($\displaystyle\int_{-\frac{b}{2}}^{\frac{b}{2}}\frac{xf'(x)}{f(x)}dx$) ends up being so ugly. Any effort on finding a compact form would be highly appreciated.


PS While one may use Euler’s representation or Taylor expansion, it is more desirable to have the final answer in a compact hyperbolic form. Any clever idea for approximating the integral is also very welcome (rough ranges: $c=350, d=5, b=1e-4, a=4e-6$). I'm not sure if it helps but FYI: $f$ is obtained by solving $f''-\frac{(f-c)}{a^2}=-\frac{d}{a^2}$ and compacting the solution nicely.

1

There are 1 best solutions below

4
On

Use the Taylor expansion

$$\log f(x)\approx \log \left(c+d- \frac{d}{\cosh \left(\frac{a b}{2}\right)}\right)-\frac{d x^2}{2 a^2 \left((c+d) \cosh \left(\frac{a b}{2}\right)-d\right)}$$

Plugging your data I got the value of the integral $I=28.605$ the error is less than $10^{-3}$ because your $\frac{b}{2}$ is about $2.4$

If you need more precision there is the $4$th degree term which is much uglier than the second one LOL and gives one more exact decimal

$$\log f(x)\approx -\frac{d x^4 \left((c+d) \cosh \left(\frac{a b}{2}\right)+2 d\right)}{24 a^4 \left(d-(c+d) \cosh \left(\frac{a b}{2}\right)\right)^2}-\frac{d x^2}{\cosh \left(\frac{a b}{2}\right) \left(2 a^2 \left(-\frac{d}{\cosh \left(\frac{a b}{2}\right)}+c+d\right)\right)}+\\ \log \left(-\frac{d}{\cosh \left(\frac{a b}{2}\right)}+c+d\right)$$

Hope this helps