Is there a general way to encode if-then-else/ITE in arithmetic, i.e. using the usual mathematical operators?
Example: let $f(x) = x^2$ if $x < 10^{30}$ and $log x$ otherwise, shortly written as $f(x) = ITE(x<10^{30},x^2,log x)$.
|
Is there a general way to encode if-then-else/ITE in arithmetic, i.e. using the usual mathematical operators? Example: let $f(x) = x^2$ if $x < 10^{30}$ and $log x$ otherwise, shortly written as $f(x) = ITE(x<10^{30},x^2,log x)$. |
|||||
|
|
If you allow the use of indicator or characteristic functions, then the answer is yes. For your example, if you let $A = \{x \in \mathbb{R}| x < 10^{30}\}$, then $f(x) = x^2 \cdot \chi_{A}(x) + \log x \cdot \chi_{A^{C}}(x)$ where $\chi_A$ and $\chi_A^{C}$ are the characteristic functions of $A$ and $A$ complement, respectively. |
|||||
|
|
This seems related to: Representing IF ... THEN ... ELSE ... in math notation Although, since none of the answers there do a particularly good job at answering the question posted here, I'll just add a little bit more: On top of what Jason wrote, you may also write:
These have the advantage that you don't need to introduce an auxiliary function (such as a characteristic function). The latter is typeset in LaTeX using:
|
|||
|
|