2
$\begingroup$

Consider the following expression:

(* In *) expr1 = Hold[Limit[Sign[x], x -> y, Direction -> "FromAbove"] == Sign[y]]

Now let's substitute a specific value to y:

(* In *) expr2 = expr1 /. y -> 0

If I now evaluate it I get inconsistent results:

(* In *) ReleaseHold[expr1]
(* Out *) True
(* In *) ReleaseHold[expr2]
(* Out *) False

In my opinion, expr1 is wrongly evaluated. I suppose that the Limit function somehow "forgets" about the special case being possible for y == 0 which leads to this problem. How could I avoid this? I would expect to get something like the following for Limit[Sign[x], x -> y, Direction -> "FromAbove"] as a correct result:

(* Out *) Piecewise[{{Sign[y], y != 0}, {1, y == 0}}]
$\endgroup$
1
  • 1
    $\begingroup$ Even using GenerateConditions -> True doesn't yield the correct answer for the limit "FromAbove". I believe this is a bug. $\endgroup$
    – Pillsy
    Aug 20, 2020 at 16:54

1 Answer 1

2
$\begingroup$

You want to use the GenerateConditions option for Limit, like so:

limit = Limit[Sign[x], x -> y, GenerateConditions -> True]
(* ConditionalExpression[Sign[y], y != 0] *)

limit /. y -> 0
(* Undefined *)

This works with many symbolic functions. In my opinion, it should default to True across the board, but the current default is Automatic, which does different things with different functions.

$\endgroup$
2
  • $\begingroup$ Thanks, I guess this will have to do, but I am still not completely happy with it since the directed limit is actually defined at y=0 and that information is not included in the input. $\endgroup$ Aug 20, 2020 at 12:43
  • $\begingroup$ Oh, I see. I forgot that option and the answer is still wrong! I'll mark it as a bug. $\endgroup$
    – Pillsy
    Aug 20, 2020 at 16:53

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.