14
$\begingroup$

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?

$\endgroup$
  • 3
    $\begingroup$ 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. $\endgroup$ – Daniel Lichtblau Dec 15 '13 at 21:49
6
$\begingroup$

One good thing about Mathematica is that when doing Series[], Mathematica understands that the singularity of $log(x)$ is different from $x^{\alpha}$ (for any $\alpha$) (for $x \rightarrow 0$), thus treated separately.

Like this:

Series[Log[x^2 + x], {x, 0, 1}]

Output

Log[x]+x+O[x]^2

Because mathematically, $$ \log(x^2+x) = \log(x (x+1)) = \log(x) + \log(x+1) = \log(x) + x + O(x^2) $$

The same procedure applies to your slightly complex expression. i.e. take out the common factor in $\log(\cdot)$, (conceptually) expand everything except $\log(x)$, truncate the Taylor series based on the hierarchy (for $x \rightarrow 0$)

$$ \cdots,\quad x,\quad x\log(x),\quad 1,\quad\log(x),\quad x^{-1},\quad \cdots $$

$\endgroup$
  • $\begingroup$ This is all on target. I should add though that this has been a tricky area to get sorted out. Try instead Log[x^2-x] to get a sense of what I mean. Some upcoming changes (for the next release) should improve on the current behavior. (NB I am not actually sure what the current version does in this case, since the computer I am on is using 11.3. But I believe 12.0 and 11.3 are the same in this case.) $\endgroup$ – Daniel Lichtblau Sep 29 at 15:57
  • $\begingroup$ The result for Log[x^2-x] looks good. The weird $i \pi$ at first glance is due to logarithm of negative number. $\endgroup$ – Eddy Xiao Sep 29 at 16:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.