I have some expressions of the type
$f(x) \,+\, g(x) \,\log(x) \,+\, h(x) \,\log(1-x^2)$
where $f$, $g$, and $h$ can be any rational functions of $x$. I am trying to use Mathematica to extract each function separately, given the expression.
I cannot simply use
Coefficient[expr, Log[x]] (* g *) Coefficient[expr, Log[1-x^2]] (* h *)
because the expression is not necessarily written in the nice form I gave above. Sometimes Mathematica prefers to write it using
Log[x^2], or to decompose
Log[1-x] + Log[1+x] and then separate the logs... For some expressions I have even seen
I have tried to use
FullSimplify with a custom
ComplexityFunction to force Mathematica to write the expression in the form I want, but it does not always work, and some of my expression are so long that I can't use
FullSimplify on them.
I don't see how I could use anything related to the asymptotics or series expansions either, because the functions $f, g$ or $h$ can have poles or zeros at $x=0$ or $1$.
Is there a way to do what I want ? I should say that what I really care about is to obtain equations equivalent to
g[x] == 0 and
h[x] == 0. If there is a way to do that without getting $g$ and $h$ that is fine as well.