TITLE: Analytic solution to definite integral problem
QUESTION [6 upvotes]: I am trying to solve an equation including a definite integral. I have a real valued function:
$f(a,b,x) = \frac{(1-x)^a}{x}\exp(-b/x)$ 
Given $a_1, b_1$ and $b_2$, I wish to find $a_2$ from the condition:
$\int_0^1 dx\ f(a_1,b_1,x) = \int_0^1 dx\ f(a_2,b_2,x)$.
If we are worried about undefined behavior at $x=0$, we can set $f(0) = 0$ always. 
My best attempt so far is to rewrite the condition as:
$\int_0^1 dx\ \ln(f(a_1,b_1,x)) = \int_0^1 dx\ \ln(f(a_2,b_2,x))$, which gives me:
$a_2 = a_1 + \int_0^1 dx\ \frac{b_1 - b_2}{x}$. That is divergent, so I will never get a number out of it.
I can of course solve it numerically, which I in fact already do. It sits in an optimization routine. But it would be much faster if an analytic answer is possible.

REPLY [3 votes]: I don't believe there is going to be an analytic solution for solving  the integral for a. (I'm happy if someone proves me wrong). 
So we need to do something practical. Here is some consideration.
You want to solve for $a_2$:
$$\int_0^1 dx\ f(a_2,b_2,x)  - \int_0^1 dx\ f(a_1,b_1,x) = 0$$
Let's rename $- \int_0^1 dx\ f(a_1,b_1,x) = G_{-1}$.
With some initial good starting value, replace $a_2$ with $a_2 + d$ where the difference $d$ will be small. So you need
$$ G(d) = G_{-1} + \int_0^1 dx\ f(a_2+d,b_2,x)  = 0$$
Now $f(a_2+d,b_2,x) = f(a_2,b_2,x) (1-x)^d $ and you can expand $(1-x)^d$ into a power series in $d$. This works, since you expand, in the integrand, 
$$ (1-x)^d = \sum_{n=0}^\infty (\ln(1-x) )^n d^n / n!
$$
EDIT: there was a wrong extra factor $(1-x)^d$ in the summands which was removed here and later.
and the terms do not diverge in the interval $x \in (0, 1)$ and the corresponding integrals exist as well. So you have
$$ G(d) =   G_{-1} + 
\sum_{n=0}^\infty d^n \quad  1/ n! \int_0^1 dx\ f(a_2,b_2,x) (\ln(1-x) )^n  = 0$$
Exemplarily, I chose some  $a_2,b_2$ and I  let Wolfram Alpha compute the first $n=10$ many terms $1/ n! \int_0^1 \cdots$ and one sees their values decrease rapidly with $n$.
So this leaves you with choosing some $N$ (depending on the desired accuracy), computing the integrals   and then solving, for $d$,  a polynomial equation 
$$ G(d) = G_{-1} + 
\sum_{n=0}^N d^n G_n = 0$$
Replacing $a_2$ with $a_2 +d$, this can then be iterated. 
Hope this makes life easier ...