[Math] Express “if true, then 1 else 0” in a formula suitable for Desmos calculator

calculatorfunctionsnotation

In programming, often the value of True is also 1, and False is 0.

This means that:

(x>5)*4

will return 4 if x is greater than 5 (because (x>5)==1), else 0.

I need to accomplish a similar thing using mathematical operators (no piecewise functions, this has to be typed into Desmos calculator.)

Specifically, I need
$$
f(x)=\begin{cases} 1&&\text{if}~ x\leq n \\ 0&&\text{otherwise} \end{cases}
$$
without having to use piecewise notation. Here $n$ is a positive integer, as is $x$.

Best Answer

(Posted by Dave Radcliffe but then deleted):

The Desmos calculator supports piecewise functions such as {x<5 : 0, 1} or {x<=5 : 0, 1}