Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I'm looking for a simple function defined as: $$ f(x) = \begin{cases} 0, & \text{ when } x = 0, \\ C, & \text{ when }x \neq 0. \end{cases} $$

Basically, I only want the constant to matter if $x \neq 0$.

share|improve this question
    
$|\mathrm{sign}(x)|$. –  J. M. Sep 15 '11 at 15:00
12  
Of course, there is such a function; in fact, you just defined it! If you want a notation, I would suggest the straightforward one $\mathbf 1_{x \neq 0}$ or the Iverson bracket $[x \neq 0]$. :-) –  Srivatsan Sep 15 '11 at 15:02
    
|sign(x)| was what I was looking for. I got it confused with x/sqrt(x^2) which isn't defined for x=0. –  moevi Sep 15 '11 at 15:16
3  
Presumably you have a system that supports the $\mathrm{sign}$ function. But if you're doing this for programming purposes, what's wrong with (x == 0 ? 0 : 1)? –  J. M. Sep 15 '11 at 15:22

4 Answers 4

Yes, there certainly is such a function! The notion that a function has to be defined by some sort of 'formula' is thoroughly out of date -- you can define a function to be anything you like, as long as it has an unambiguous value for each of its arguments.

You forgot to specify what the possible arguments of this function are, so -- to be complete -- you need to do that. Do you want your function to be defined on the set of real numbers? Then you should say so.

share|improve this answer
2  
+1 is thoroughly out of date: More precisely, that occured around 1750-1800 (Euler still had it not entirely clear) gap-system.org/~history/HistTopics/Functions.html –  leonbloy Sep 15 '11 at 15:12
    
@leonbloy: I would say that your link misses the point entirely: that a function from $D$ to $R$ is a subset of $D\times R$ that satisfies some simple conditions. This is obviously (with the benefit of hindsight!) a much better definition than any of those given there. The set-theoretic definition of Patrick Suppes that is given at the end is in the spirit of "gosh, look at this!", and no attempt is made to make sense of it. So the page gets a B- from me. –  TonyK Sep 15 '11 at 15:27

You had just defined it :-)

What about $f(x) = C \cdot \mathrm{sign}(|x|)$?

share|improve this answer

You can define your function $f: \Bbb R \longrightarrow \{0, 1\}$ as follows: $f(0) = 0$ and $f(x) = 1$ for $x \neq 0$.

share|improve this answer

You can write it as $C\cdot(1-\delta_0)$ where $\delta_0(x)=1$ if $x=0$ and otherwise $\delta_0(x)=0$.

Generally speaking, though, functions do not need to be defined by a formula. Most functions, in fact, cannot be defined by formulas. Function is some sort of a machine which is designed to result in a particular output when entered a particular input. What's inside? Magic!

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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