5
$\begingroup$

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?

$\endgroup$
11
  • $\begingroup$ If you are looking to report a bug, please contact Wolfram support directly. What sort of workaround are you looking for? $\endgroup$
    – Szabolcs
    Commented Jan 14, 2015 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$ Commented Jan 14, 2015 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$ Commented Jan 14, 2015 at 18:02
  • 3
    $\begingroup$ Limit does not in general find the tightest possible interval for functions that oscillate. $\endgroup$ Commented Jan 14, 2015 at 21:14
  • 1
    $\begingroup$ (Apropos of tagging,) I do not regard this as a bug. $\endgroup$ Commented Jan 15, 2015 at 15:43

3 Answers 3

6
$\begingroup$

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]}]
$\endgroup$
2
  • $\begingroup$ Any idea why this works? $\endgroup$
    – Mr.Wizard
    Commented Jan 14, 2015 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
    Commented Jan 15, 2015 at 0:45
5
$\begingroup$

A limited kind of work-around:

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

TrigReduce //@ expr /. x -> Interval[∞]
Interval[{Log[3/2], Log[5/2]}]
$\endgroup$
5
  • $\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
    Commented Jan 14, 2015 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
    Commented Jan 14, 2015 at 18:21
  • $\begingroup$ @ Mr.Wizard: Could that be called a workaround? I think the answer is no. $\endgroup$
    – user64494
    Commented Jan 14, 2015 at 18:26
  • $\begingroup$ @user64494 Hey, I'm trying. :^) $\endgroup$
    – Mr.Wizard
    Commented Jan 14, 2015 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
    Commented Jan 14, 2015 at 22:44
4
$\begingroup$
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]}]

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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