3

Here's a simple WolframCloud computation:

enter image description here

The answer is 1 when 0 < x < 1 is True and 0 when 0 < x < 1 is False, so why in the world does the output associate True with 0?

(In WolframAlpha, executing Limit[Boole[0<x<1] (1 + 1/a) ,a->Infinity] displays the correct answer, i.e., Boole[0<x<1], but the strange result is still found when you click "Open code".)

EDIT: An alternative form that gives the same result is

f[x_,a_]:=Boole[0<x<1] (1 + 1/a)
Limit[f[x,a],a->Infinity]

The output should be Boole[0<x<1], but instead is the strangeness involving True.

r.e.s.
  • 227
  • 3
  • 11

3 Answers3

1

Seems that where is a bug in WolframAlpha sandbox - it probably can't deduce that your analyzed Boole[0 < x < 1] expression is independent of limit calculation and thus computes incorrectly. To get correct results - put Boole function in front of limit:

Boole[0 < x < 1] Limit[(1 + a^(-1)), a -> Infinity]

BTW, WolframAlpha online calculation shows answer correctly

Agnius Vasiliauskas
  • 10,935
  • 5
  • 50
  • 70
  • Unfortunately, the strangeness involving `True` occurs also with more-complicated piecewise functions defined using Boole[], for which the Boole[] part can't be factored out. Also, although WolframAlpha doesn't display it immediately, it is happening in the Wolfram language (shown when you click "Open code"). – r.e.s. Aug 31 '18 at 13:58
  • 1
    I have a gut feeling that simply there is a bug that they used not that constant (True, instead of False). Because structure of answer output is that `0` part corresponds to `otherwise` part. That should be `False`, because there can't be two `True` branches in Boole case. So just a stupid bug – Agnius Vasiliauskas Aug 31 '18 at 15:18
  • It turns out that this is not a bug, but is standard Wolfram output style for piecewise functions. (See [my answer](https://stackoverflow.com/a/52192727/1033647).) – r.e.s. Sep 05 '18 at 20:13
0

Your expression makes little sense. It is not an equation and x is undefined. what are you trying to calculate?

Boole[expr]  (* yields 1 if expr is True and 0 if it is False. *)
Limit[expr,x->Subscript[x, 0]]  (* finds the limiting value of expr when x approaches Subscript[x, 0]. *)

Thus, Boole[0<x<1] will always yield 1 or 0 and is independent of a. However, Limit[1+1/a, a-> Infinity] is independent of x and will always yield 1.

Simplifying this expression you get n * 1 where n belong to [0,1], and is fully dependant on x.

My guess is that your input confuses the Mathematica, hence the weird output. btw. on Mathematica desktop the output is

Boole[0 < x < 1]

Showing that the value of the expression fully depends on the x as I described above..

Eriks Klotins
  • 4,042
  • 1
  • 12
  • 26
0

Although at first it seems quite strange (or, indeed, a bug), in Wolfram language this is a standard usage of True in the output of piecewise functions, where it has the meaning of "otherwise" (when all the other listed conditions, which are to be evaluated in order, are False).

In other words, such an output expression is to be understood as a list of {value, condition} pairs, which evaluates to the first listed value whose condition is True, as in the following examples:

enter image description here

r.e.s.
  • 227
  • 3
  • 11