The code

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


Interval[{0, Log[3]}]

in Mathematica . It should be

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

instead of. Is there a workaround?

  • $\begingroup$ If you are looking to report a bug, please contact Wolfram support directly. What sort of workaround are you looking for? $\endgroup$ – Szabolcs Jan 14 '15 at 17:24
  • 3
    $\begingroup$ Posting here as in addition reporting the bug to support is also a very nice option in my opinion. $\endgroup$ – Jacob Akkerboom Jan 14 '15 at 17:39
  • 4
    $\begingroup$ @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. $\endgroup$ – Sjoerd C. de Vries Jan 14 '15 at 18:02
  • 3
    $\begingroup$ Limit does not in general find the tightest possible interval for functions that oscillate. $\endgroup$ – Daniel Lichtblau Jan 14 '15 at 21:14
  • 1
    $\begingroup$ (Apropos of tagging,) I do not regard this as a bug. $\endgroup$ – 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]}]
  • $\begingroup$ Any idea why this works? $\endgroup$ – Mr.Wizard Jan 14 '15 at 23:05
  • 1
    $\begingroup$ @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. $\endgroup$ – 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]}]
  • $\begingroup$ Sorry, I don't see any Limit in your code. You found the range of expr = Log[2 - Sin[x]*Cos[x]];. $\endgroup$ – user64494 Jan 14 '15 at 18:19
  • $\begingroup$ @user64494 Yes, it is not very general. The result is right in the particular case however, is it not? $\endgroup$ – Mr.Wizard Jan 14 '15 at 18:21
  • $\begingroup$ @ Mr.Wizard: Could that be called a workaround? I think the answer is no. $\endgroup$ – user64494 Jan 14 '15 at 18:26
  • $\begingroup$ @user64494 Hey, I'm trying. :^) $\endgroup$ – Mr.Wizard Jan 14 '15 at 18:26
  • $\begingroup$ @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. $\endgroup$ – 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]]


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]}]

  • $\begingroup$ @ 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? $\endgroup$ – user64494 Jan 14 '15 at 20:17
  • $\begingroup$ @ Bob Hanlon: One of the votes up is mine. $\endgroup$ – user64494 Jan 14 '15 at 21:27

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.