# How does Mathematica find a series expansion of expressions containing logarithms when there is a singularity at the expansion point?

I am looking for a good approximation to a function containing logarithms, especially at values close to zero. When I used Mathematica's Series command I found something unexpected.

Mathematica seems to expand expressions containing a logarithm differently when there is a singularity at the expansion point. For example, the function $(a+\log[x^3+x^7])/(b+x)$ has a singularity at $x=0$. If I use Series with an expansion point greater than zero, I get the expected Taylor expansion. However, at the expansion point zero I get

$$\frac{a + 3 \log(x)}{b} + \frac{(-a - 3 \log(x)) x}{b^2} + O(x)^2.$$

It strikes me that the logarithm is retained as a function in $x$. And this result approximates the function much better than that of a simple Taylor series. Mathematica somehow separates the logarithm from the expansion, which I find quite intelligent. I would like to know what technique Mathematica uses and how it is called. I never came across such a thing and would be interested in learning more about it.

I understand that Series can use several expansions and choses an appropriate one depending on the problem, so maybe this is a special procedure to treat expressions with logarithms.

I also found (with some trial and error) that Mathematica's result equals the one I would get if I first did a Taylor expansion of the expression, but treating all logarithms as constants, and then reduced all logarithmic arguments to the lowest power of $x$. Why is this justified?

-
Mathematica is using some rudimentary tactics to separate out log, exponential, and related singularities. It is useful for many things such as finding limits and getting "good" approximations. For more complicated examples some flavor of exp-log series would be needed. –  Daniel Lichtblau Dec 15 '13 at 21:49