Bug in complicated Limit

The code

Limit[Log[2 - Sin[x]*Cos[x]], x -> Infinity]


outputs

Interval[{0, Log[3]}]


in Mathematica 10.0.2.0 . It should be

Interval[{Log[3/2]}, Log[5/2]}]


instead of. Is there a workaround?

• If you are looking to report a bug, please contact Wolfram support directly. What sort of workaround are you looking for? – Szabolcs Jan 14 '15 at 17:24
• Posting here as in addition reporting the bug to support is also a very nice option in my opinion. – Jacob Akkerboom Jan 14 '15 at 17:39
• @user64494 Most or all of those 500 questions were vetted by the community first before they received the bugs tag. The tag description (mouseover the tag) mentions that as well. Anyway, Limit[Sin[x]*Cos[x], x -> Infinity] is a simple example of the bug. – Sjoerd C. de Vries Jan 14 '15 at 18:02
• Limit does not in general find the tightest possible interval for functions that oscillate. – Daniel Lichtblau Jan 14 '15 at 21:14
• (Apropos of tagging,) I do not regard this as a bug. – Daniel Lichtblau Jan 15 '15 at 15:43

Slow down the approach,

Limit[Log[2 - Sin[x]*Cos[x]] /. x -> x/2, x -> Infinity]


or speed it up,

Limit[Log[2 - Sin[x]*Cos[x]] /. x -> 2 x, x -> Infinity]


-- both yield

Interval[{Log[3/2], Log[5/2]}]

• Any idea why this works? – Mr.Wizard Jan 14 '15 at 23:05
• @Mr.Wizard I had an idea when I tried it, but not after looking at the Trace, which was unilluminating. My feeling was that the transformation Sin[2x] -> 2 Sin[x] Cos[x], getting the trig. fns. in terms of x (e.g. TrigExpand), and Sin, Cos being between ±1 might be tempting M. Changing x in the above and similar ways seems to work, perhaps by preventing the double angle formula from being applied. It was basically a guess. BTW, in my view of how Limit and Interval work, I think both results are "correct," although a more precise result is more desirable. – Michael E2 Jan 15 '15 at 0:45

A limited kind of work-around:

expr = Log[2 - Sin[x]*Cos[x]];

TrigReduce //@ expr /. x -> Interval[∞]

Interval[{Log[3/2], Log[5/2]}]

• Sorry, I don't see any Limit in your code. You found the range of expr = Log[2 - Sin[x]*Cos[x]];. – user64494 Jan 14 '15 at 18:19
• @user64494 Yes, it is not very general. The result is right in the particular case however, is it not? – Mr.Wizard Jan 14 '15 at 18:21
• @ Mr.Wizard: Could that be called a workaround? I think the answer is no. – user64494 Jan 14 '15 at 18:26
• @user64494 Hey, I'm trying. :^) – Mr.Wizard Jan 14 '15 at 18:26
• @user64494 Why do you say Mr.Wizard found the range? Other than the fact that your so-called limit is the same as the range, which is itself a source of confusion in any case, the computation does not represent finding the range. It more closely represents finding the limit. – Michael E2 Jan 14 '15 at 22:44
f[x_] = Log[2 - Sin[x]*Cos[x]];

Simplify[f[x] == f[x + n Pi], Element[n, Integers]]


True

Since the function is periodic, the limit interval is just the minimum and maximum of the function.

Interval@(f[x] /. Solve[{f'[x] == 0, 0 <= x <= 2 Pi}, x, Reals] //
FullSimplify // Union)


Interval[{Log[3/2], Log[5/2]}]

Alternatively, with version 10

FunctionRange[f[x], x, y] // FullSimplify


Log[3/2] <= y <= Log[5/2]

Interval@Cases[%, _?NumericQ]


Interval[{Log[3/2], Log[5/2]}]

• @ Bob Hanlon : Having noticed "Since the function is periodic, the limit interval is just the minimum and maximum of the function", you found the minimum and the maximum. This is true only for continuous functions. Nevertheless, I find it smart. However, that way is found by hand and only realized with Mathematica. Could that be called a workaround? – user64494 Jan 14 '15 at 20:17
• @ Bob Hanlon: One of the votes up is mine. – user64494 Jan 14 '15 at 21:27