$f(x) = 0$ when $x$ is $0$, and $1$ otherwise
I've been trying to create a function that will return $0$ when $x$ is $0$, and for any other $x$ value it should return $1$. I've searched for a pre-existing function online too and wasn't able to find one.
Do you know of any function that can do this?
functions boolean-algebra binary
|
show 1 more comment
I've been trying to create a function that will return $0$ when $x$ is $0$, and for any other $x$ value it should return $1$. I've searched for a pre-existing function online too and wasn't able to find one.
Do you know of any function that can do this?
functions boolean-algebra binary
9
This will do: $$f(x)=begin{cases}0,&x=0\{}1,&xneq 0end{cases}$$
– DonAntonio
Jun 13 '16 at 21:59
1
Perhaps $f(x)=|text{sgn}(x)|$ or $f(x)=text{sgn}(x)^2$ using the absolute value or square of the sign function
– Henry
Jun 13 '16 at 22:03
@David_Shmij: That is a combination of elementary function, namely the constant function $0$ and the constant function $1$ (which are both pretty elementary)!
– Henning Makholm
Jun 13 '16 at 22:05
1
@David_Shmij: Which programming language are you talking about here? Most I know will allow you to write eitherx==0?0:1
or something likeif x=0 then 0 else 1
, which both seem pretty easy to me.
– Henning Makholm
Jun 13 '16 at 22:17
@David_Shmij: Wolfram's syntax is slightly bizzarre, but you can writePiecewise[{{0,x=0}},1]
and then multiply by $5$ to your heart's content. Example here.
– Henning Makholm
Jun 13 '16 at 23:05
|
show 1 more comment
I've been trying to create a function that will return $0$ when $x$ is $0$, and for any other $x$ value it should return $1$. I've searched for a pre-existing function online too and wasn't able to find one.
Do you know of any function that can do this?
functions boolean-algebra binary
I've been trying to create a function that will return $0$ when $x$ is $0$, and for any other $x$ value it should return $1$. I've searched for a pre-existing function online too and wasn't able to find one.
Do you know of any function that can do this?
functions boolean-algebra binary
functions boolean-algebra binary
edited Jun 13 '16 at 22:15
David_Shmij
368217
368217
asked Jun 13 '16 at 21:58
Albert Renshaw
7271627
7271627
9
This will do: $$f(x)=begin{cases}0,&x=0\{}1,&xneq 0end{cases}$$
– DonAntonio
Jun 13 '16 at 21:59
1
Perhaps $f(x)=|text{sgn}(x)|$ or $f(x)=text{sgn}(x)^2$ using the absolute value or square of the sign function
– Henry
Jun 13 '16 at 22:03
@David_Shmij: That is a combination of elementary function, namely the constant function $0$ and the constant function $1$ (which are both pretty elementary)!
– Henning Makholm
Jun 13 '16 at 22:05
1
@David_Shmij: Which programming language are you talking about here? Most I know will allow you to write eitherx==0?0:1
or something likeif x=0 then 0 else 1
, which both seem pretty easy to me.
– Henning Makholm
Jun 13 '16 at 22:17
@David_Shmij: Wolfram's syntax is slightly bizzarre, but you can writePiecewise[{{0,x=0}},1]
and then multiply by $5$ to your heart's content. Example here.
– Henning Makholm
Jun 13 '16 at 23:05
|
show 1 more comment
9
This will do: $$f(x)=begin{cases}0,&x=0\{}1,&xneq 0end{cases}$$
– DonAntonio
Jun 13 '16 at 21:59
1
Perhaps $f(x)=|text{sgn}(x)|$ or $f(x)=text{sgn}(x)^2$ using the absolute value or square of the sign function
– Henry
Jun 13 '16 at 22:03
@David_Shmij: That is a combination of elementary function, namely the constant function $0$ and the constant function $1$ (which are both pretty elementary)!
– Henning Makholm
Jun 13 '16 at 22:05
1
@David_Shmij: Which programming language are you talking about here? Most I know will allow you to write eitherx==0?0:1
or something likeif x=0 then 0 else 1
, which both seem pretty easy to me.
– Henning Makholm
Jun 13 '16 at 22:17
@David_Shmij: Wolfram's syntax is slightly bizzarre, but you can writePiecewise[{{0,x=0}},1]
and then multiply by $5$ to your heart's content. Example here.
– Henning Makholm
Jun 13 '16 at 23:05
9
9
This will do: $$f(x)=begin{cases}0,&x=0\{}1,&xneq 0end{cases}$$
– DonAntonio
Jun 13 '16 at 21:59
This will do: $$f(x)=begin{cases}0,&x=0\{}1,&xneq 0end{cases}$$
– DonAntonio
Jun 13 '16 at 21:59
1
1
Perhaps $f(x)=|text{sgn}(x)|$ or $f(x)=text{sgn}(x)^2$ using the absolute value or square of the sign function
– Henry
Jun 13 '16 at 22:03
Perhaps $f(x)=|text{sgn}(x)|$ or $f(x)=text{sgn}(x)^2$ using the absolute value or square of the sign function
– Henry
Jun 13 '16 at 22:03
@David_Shmij: That is a combination of elementary function, namely the constant function $0$ and the constant function $1$ (which are both pretty elementary)!
– Henning Makholm
Jun 13 '16 at 22:05
@David_Shmij: That is a combination of elementary function, namely the constant function $0$ and the constant function $1$ (which are both pretty elementary)!
– Henning Makholm
Jun 13 '16 at 22:05
1
1
@David_Shmij: Which programming language are you talking about here? Most I know will allow you to write either
x==0?0:1
or something like if x=0 then 0 else 1
, which both seem pretty easy to me.– Henning Makholm
Jun 13 '16 at 22:17
@David_Shmij: Which programming language are you talking about here? Most I know will allow you to write either
x==0?0:1
or something like if x=0 then 0 else 1
, which both seem pretty easy to me.– Henning Makholm
Jun 13 '16 at 22:17
@David_Shmij: Wolfram's syntax is slightly bizzarre, but you can write
Piecewise[{{0,x=0}},1]
and then multiply by $5$ to your heart's content. Example here.– Henning Makholm
Jun 13 '16 at 23:05
@David_Shmij: Wolfram's syntax is slightly bizzarre, but you can write
Piecewise[{{0,x=0}},1]
and then multiply by $5$ to your heart's content. Example here.– Henning Makholm
Jun 13 '16 at 23:05
|
show 1 more comment
8 Answers
8
active
oldest
votes
How about $f(x)=leftlceilfrac{x^2}{x^2+1}rightrceil$
*Works for real numbers, with imaginary numbers you may divide by 0.
3
That's pretty unreadable compared to Joanpemo's straightforward definition.
– Henning Makholm
Jun 13 '16 at 22:07
The function you gave is the case of when x <= 0! You need to multiply it with another term. Just multiply it with f(-x). In terms of Boolean manipulation, this would be the same as ANDing the set of x <= 0 with the set -x <= 0. That should fix your problem.
– The Great Duck
Jun 13 '16 at 22:14
2
@TheGreatDuck The function is even. So there is no difference between the case $xle 0$ and the case $xge 0$.
– user228113
Jun 13 '16 at 22:17
1
@G. Sassatelli You are correct. I am used to using x on top when defining iverson brackets with floor. I didn't look carefully enough. Oops. :p
– The Great Duck
Jun 13 '16 at 22:42
@Barry Cipra, Thanks. Yes, you're right. I made the function to be $1$ at $0$ and $0$ elsewhere. I will fix it.
– paw88789
Jun 13 '16 at 23:16
|
show 2 more comments
You've already defined your function (assuming you've also chosen its domain).
One of the main ways to "create" a function is simply by specifying its values at all points, and your description has done so.
Typical notation for a function created by the sort of description you give is a definition by cases:
$$ f(x) := begin{cases} 0 & x = 0 \ 1 & x neq 0 end{cases} $$
For many applications — most applications, I expect — this is one of the best descriptions of said function. If need be, name it with a letter, and continue on with whatever you're doing.
The complementary function
$$ g(x) := begin{cases} 1 & x = 0 \ 0 & x neq 0 end{cases} $$
which is related to your function by $f(x) = 1 - g(x)$ comes up often enough in some contexts to have been given a name and notation: e.g.
- The Kronecker delta. A few different notations exist depending on the setting; e.g. $delta_x$, $delta[x]$, or $delta_{x,0}$.
- The Iverson bracket. This would be notated $[x = 0]$. This notation is, IMO, indispensable for doing complicated calculations with summations.
x == 0
computes this function inC
andC++
, and many other programming languages allow similar.
Some applications might want to represent such a function in particular ways. For example, if one only cares about the value of $g(x)$ when $x$ is an integer, but strongly prefers to work with analytic functions (e.g. because you're studying a sequence using complex analysis), one has the fact that
$$ g(x) = mathop{mathrm{sinc}}(pi x) $$
holds whenever $x$ is an integer.
(if you're unfamiliar with it, $mathop{mathrm{sinc}}(z)$ is the continuous extension of $sin(z) / z$)
1
In some settings, $0^x$ could be used as another notation for this, but would likely look out of place.
– Hurkyl
Jun 13 '16 at 22:45
2
$0^x$ would be iffy at best if $x$ can be negative ...
– Henning Makholm
Jun 13 '16 at 23:07
+1 Thanks, this is a resourceful answer because you referenced Kronecker Delta which was great to read about and see some of the sigma-notated and integral-notated versions of it. As for the piece-wise function, unfortunately I'm working on applying this function into a larger function to simplify the super-function, I can't simplify using a piece-wise function because identities don't exist for custom piece-wise functions and therefor it's hard to cancel stuff out.
– Albert Renshaw
Jun 14 '16 at 4:43
Also for the sinc(πx) only wokring when x is an integer, we can just use floor or ceiling function on x to get it working for all values of x, that's a great answer too for what I'm trying to do except when I look at the definition of sinc, it seems to be piece-wise too, doh
– Albert Renshaw
Jun 14 '16 at 4:44
@Henning, since you mention it: have you already seen Knuth's article on notations? There is a mention of the interesting history of $0^x$ in there...
– J. M. is not a mathematician
Jun 15 '16 at 18:04
|
show 2 more comments
How about $f(x)= 1-delta_{x,0}$ (using the Kronecker Delta function, in Mathematica/WolframAlpha can write the $delta_{x,0}$ as
kroneckerdelta(x,0)
)
add a comment |
Here's one using $sum$ notation although it only works for the natural numbers:
$f(x) = sumlimits_{i = 1}^{x}{frac{1}{x}} $
Due to the empty sum being 0.
It can't be simplified to $f(x) = x times frac{1}{x}$ because then f(0) would be undefined.
1
I think this satisfies the0 when x=0
part but what about the1 otherwise
part? Is there something I do, with x, to f(x), after to get to 1 every time?
– Albert Renshaw
Oct 21 at 4:12
1
When $x = 1$ it's just $frac{1}{1}$, when $x = 2$ it's $frac{1}{2} + frac{1}{2}$ which is $frac{2}{2}$ which is 1, in general it's $frac{1}{n} + frac{1}{n} + ... + frac{1}{n}$ repeated $n$ times, which is simply $frac{n}{n}$ which is $1$
– omer
Oct 21 at 16:23
Oh I'm sorry! I wrote $n$ instead of $x$. I'll edit it. Should make more sense now
– omer
Oct 21 at 16:35
add a comment |
Without using floor or ceiling it can be done with limits. Start with a function of this form:
$$lim_{c to infty} left (frac{y}{sqrt2}-frac{(xcdot c)}{sqrt2} = sqrt[3]{1-left ( frac{y}{sqrt2}+frac{(xcdot c)}{sqrt2} right )^3 } right )$$
(Note: Using real-valued root not principal root)
This infinitely squashes (along x-axis) a 45º rotated graph of the form $x^3+y^3=1$ which causes the output values to be $0$ everywhere and $sqrt[6]{2}$ at $0$. This can now easily be worked to achieve the desired affect by dividing by $sqrt[6]{2}$ and subtracting from $1$
add a comment |
The following equation I’ve made works without using ceiling function or limits or infinite sums when plotting the real values. 1 at x=0 and 0 and a complex pair counterpart at all other values for x
$(y-1-sqrt{x}-sqrt{-x})cdotfrac{y}{y-x}=0$
This can then be inverted to a less elegant form to have 0 for x=0 and 1 in all other places.
I like this best because it’s pure closed form expression and doesn’t involve any elements like ceiling function that are hard to work with when using this in other places. However it only works if you ignore complex answers which has problems of its own, but still is noteworthy and has application
add a comment |
The following equation I've made is a closed-form expression of KroneckerDelta (j=0 form) which will evaluate y=1 at x=0 and y=0 for x≠0.
$$(frac{y}{y-x})cdot((y-1)^2+x^2)=0$$
This function can be subtracted from 1 to achieve the desired result
The function was formed by taking the function for a horizontal line at 0, divided by a 45º line (y=x) through the origin to create a hole in the function at x=0, then multiplied by a circle with radius 0 whose origin is at (0,1) to create a point at (0,1).
add a comment |
Paw88789's answer worked great for what I'm trying to do; the only issue was that it didn't work for all "numbers"; some imaginary numbers would cause division by 0. Luckily tonight I was able to create a function that produced the desired result for all numbers, including imaginary/complex.
$f(x) = left lceil frac{1}{2Gamma left ( left | x right | right )} right rceil$
*Note the absolute value inside of Gamma, as it's easy to go unnoticed
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "69"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f1825057%2ffx-0-when-x-is-0-and-1-otherwise%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
8 Answers
8
active
oldest
votes
8 Answers
8
active
oldest
votes
active
oldest
votes
active
oldest
votes
How about $f(x)=leftlceilfrac{x^2}{x^2+1}rightrceil$
*Works for real numbers, with imaginary numbers you may divide by 0.
3
That's pretty unreadable compared to Joanpemo's straightforward definition.
– Henning Makholm
Jun 13 '16 at 22:07
The function you gave is the case of when x <= 0! You need to multiply it with another term. Just multiply it with f(-x). In terms of Boolean manipulation, this would be the same as ANDing the set of x <= 0 with the set -x <= 0. That should fix your problem.
– The Great Duck
Jun 13 '16 at 22:14
2
@TheGreatDuck The function is even. So there is no difference between the case $xle 0$ and the case $xge 0$.
– user228113
Jun 13 '16 at 22:17
1
@G. Sassatelli You are correct. I am used to using x on top when defining iverson brackets with floor. I didn't look carefully enough. Oops. :p
– The Great Duck
Jun 13 '16 at 22:42
@Barry Cipra, Thanks. Yes, you're right. I made the function to be $1$ at $0$ and $0$ elsewhere. I will fix it.
– paw88789
Jun 13 '16 at 23:16
|
show 2 more comments
How about $f(x)=leftlceilfrac{x^2}{x^2+1}rightrceil$
*Works for real numbers, with imaginary numbers you may divide by 0.
3
That's pretty unreadable compared to Joanpemo's straightforward definition.
– Henning Makholm
Jun 13 '16 at 22:07
The function you gave is the case of when x <= 0! You need to multiply it with another term. Just multiply it with f(-x). In terms of Boolean manipulation, this would be the same as ANDing the set of x <= 0 with the set -x <= 0. That should fix your problem.
– The Great Duck
Jun 13 '16 at 22:14
2
@TheGreatDuck The function is even. So there is no difference between the case $xle 0$ and the case $xge 0$.
– user228113
Jun 13 '16 at 22:17
1
@G. Sassatelli You are correct. I am used to using x on top when defining iverson brackets with floor. I didn't look carefully enough. Oops. :p
– The Great Duck
Jun 13 '16 at 22:42
@Barry Cipra, Thanks. Yes, you're right. I made the function to be $1$ at $0$ and $0$ elsewhere. I will fix it.
– paw88789
Jun 13 '16 at 23:16
|
show 2 more comments
How about $f(x)=leftlceilfrac{x^2}{x^2+1}rightrceil$
*Works for real numbers, with imaginary numbers you may divide by 0.
How about $f(x)=leftlceilfrac{x^2}{x^2+1}rightrceil$
*Works for real numbers, with imaginary numbers you may divide by 0.
edited Jun 14 '16 at 5:00
Albert Renshaw
7271627
7271627
answered Jun 13 '16 at 22:06
paw88789
29k12349
29k12349
3
That's pretty unreadable compared to Joanpemo's straightforward definition.
– Henning Makholm
Jun 13 '16 at 22:07
The function you gave is the case of when x <= 0! You need to multiply it with another term. Just multiply it with f(-x). In terms of Boolean manipulation, this would be the same as ANDing the set of x <= 0 with the set -x <= 0. That should fix your problem.
– The Great Duck
Jun 13 '16 at 22:14
2
@TheGreatDuck The function is even. So there is no difference between the case $xle 0$ and the case $xge 0$.
– user228113
Jun 13 '16 at 22:17
1
@G. Sassatelli You are correct. I am used to using x on top when defining iverson brackets with floor. I didn't look carefully enough. Oops. :p
– The Great Duck
Jun 13 '16 at 22:42
@Barry Cipra, Thanks. Yes, you're right. I made the function to be $1$ at $0$ and $0$ elsewhere. I will fix it.
– paw88789
Jun 13 '16 at 23:16
|
show 2 more comments
3
That's pretty unreadable compared to Joanpemo's straightforward definition.
– Henning Makholm
Jun 13 '16 at 22:07
The function you gave is the case of when x <= 0! You need to multiply it with another term. Just multiply it with f(-x). In terms of Boolean manipulation, this would be the same as ANDing the set of x <= 0 with the set -x <= 0. That should fix your problem.
– The Great Duck
Jun 13 '16 at 22:14
2
@TheGreatDuck The function is even. So there is no difference between the case $xle 0$ and the case $xge 0$.
– user228113
Jun 13 '16 at 22:17
1
@G. Sassatelli You are correct. I am used to using x on top when defining iverson brackets with floor. I didn't look carefully enough. Oops. :p
– The Great Duck
Jun 13 '16 at 22:42
@Barry Cipra, Thanks. Yes, you're right. I made the function to be $1$ at $0$ and $0$ elsewhere. I will fix it.
– paw88789
Jun 13 '16 at 23:16
3
3
That's pretty unreadable compared to Joanpemo's straightforward definition.
– Henning Makholm
Jun 13 '16 at 22:07
That's pretty unreadable compared to Joanpemo's straightforward definition.
– Henning Makholm
Jun 13 '16 at 22:07
The function you gave is the case of when x <= 0! You need to multiply it with another term. Just multiply it with f(-x). In terms of Boolean manipulation, this would be the same as ANDing the set of x <= 0 with the set -x <= 0. That should fix your problem.
– The Great Duck
Jun 13 '16 at 22:14
The function you gave is the case of when x <= 0! You need to multiply it with another term. Just multiply it with f(-x). In terms of Boolean manipulation, this would be the same as ANDing the set of x <= 0 with the set -x <= 0. That should fix your problem.
– The Great Duck
Jun 13 '16 at 22:14
2
2
@TheGreatDuck The function is even. So there is no difference between the case $xle 0$ and the case $xge 0$.
– user228113
Jun 13 '16 at 22:17
@TheGreatDuck The function is even. So there is no difference between the case $xle 0$ and the case $xge 0$.
– user228113
Jun 13 '16 at 22:17
1
1
@G. Sassatelli You are correct. I am used to using x on top when defining iverson brackets with floor. I didn't look carefully enough. Oops. :p
– The Great Duck
Jun 13 '16 at 22:42
@G. Sassatelli You are correct. I am used to using x on top when defining iverson brackets with floor. I didn't look carefully enough. Oops. :p
– The Great Duck
Jun 13 '16 at 22:42
@Barry Cipra, Thanks. Yes, you're right. I made the function to be $1$ at $0$ and $0$ elsewhere. I will fix it.
– paw88789
Jun 13 '16 at 23:16
@Barry Cipra, Thanks. Yes, you're right. I made the function to be $1$ at $0$ and $0$ elsewhere. I will fix it.
– paw88789
Jun 13 '16 at 23:16
|
show 2 more comments
You've already defined your function (assuming you've also chosen its domain).
One of the main ways to "create" a function is simply by specifying its values at all points, and your description has done so.
Typical notation for a function created by the sort of description you give is a definition by cases:
$$ f(x) := begin{cases} 0 & x = 0 \ 1 & x neq 0 end{cases} $$
For many applications — most applications, I expect — this is one of the best descriptions of said function. If need be, name it with a letter, and continue on with whatever you're doing.
The complementary function
$$ g(x) := begin{cases} 1 & x = 0 \ 0 & x neq 0 end{cases} $$
which is related to your function by $f(x) = 1 - g(x)$ comes up often enough in some contexts to have been given a name and notation: e.g.
- The Kronecker delta. A few different notations exist depending on the setting; e.g. $delta_x$, $delta[x]$, or $delta_{x,0}$.
- The Iverson bracket. This would be notated $[x = 0]$. This notation is, IMO, indispensable for doing complicated calculations with summations.
x == 0
computes this function inC
andC++
, and many other programming languages allow similar.
Some applications might want to represent such a function in particular ways. For example, if one only cares about the value of $g(x)$ when $x$ is an integer, but strongly prefers to work with analytic functions (e.g. because you're studying a sequence using complex analysis), one has the fact that
$$ g(x) = mathop{mathrm{sinc}}(pi x) $$
holds whenever $x$ is an integer.
(if you're unfamiliar with it, $mathop{mathrm{sinc}}(z)$ is the continuous extension of $sin(z) / z$)
1
In some settings, $0^x$ could be used as another notation for this, but would likely look out of place.
– Hurkyl
Jun 13 '16 at 22:45
2
$0^x$ would be iffy at best if $x$ can be negative ...
– Henning Makholm
Jun 13 '16 at 23:07
+1 Thanks, this is a resourceful answer because you referenced Kronecker Delta which was great to read about and see some of the sigma-notated and integral-notated versions of it. As for the piece-wise function, unfortunately I'm working on applying this function into a larger function to simplify the super-function, I can't simplify using a piece-wise function because identities don't exist for custom piece-wise functions and therefor it's hard to cancel stuff out.
– Albert Renshaw
Jun 14 '16 at 4:43
Also for the sinc(πx) only wokring when x is an integer, we can just use floor or ceiling function on x to get it working for all values of x, that's a great answer too for what I'm trying to do except when I look at the definition of sinc, it seems to be piece-wise too, doh
– Albert Renshaw
Jun 14 '16 at 4:44
@Henning, since you mention it: have you already seen Knuth's article on notations? There is a mention of the interesting history of $0^x$ in there...
– J. M. is not a mathematician
Jun 15 '16 at 18:04
|
show 2 more comments
You've already defined your function (assuming you've also chosen its domain).
One of the main ways to "create" a function is simply by specifying its values at all points, and your description has done so.
Typical notation for a function created by the sort of description you give is a definition by cases:
$$ f(x) := begin{cases} 0 & x = 0 \ 1 & x neq 0 end{cases} $$
For many applications — most applications, I expect — this is one of the best descriptions of said function. If need be, name it with a letter, and continue on with whatever you're doing.
The complementary function
$$ g(x) := begin{cases} 1 & x = 0 \ 0 & x neq 0 end{cases} $$
which is related to your function by $f(x) = 1 - g(x)$ comes up often enough in some contexts to have been given a name and notation: e.g.
- The Kronecker delta. A few different notations exist depending on the setting; e.g. $delta_x$, $delta[x]$, or $delta_{x,0}$.
- The Iverson bracket. This would be notated $[x = 0]$. This notation is, IMO, indispensable for doing complicated calculations with summations.
x == 0
computes this function inC
andC++
, and many other programming languages allow similar.
Some applications might want to represent such a function in particular ways. For example, if one only cares about the value of $g(x)$ when $x$ is an integer, but strongly prefers to work with analytic functions (e.g. because you're studying a sequence using complex analysis), one has the fact that
$$ g(x) = mathop{mathrm{sinc}}(pi x) $$
holds whenever $x$ is an integer.
(if you're unfamiliar with it, $mathop{mathrm{sinc}}(z)$ is the continuous extension of $sin(z) / z$)
1
In some settings, $0^x$ could be used as another notation for this, but would likely look out of place.
– Hurkyl
Jun 13 '16 at 22:45
2
$0^x$ would be iffy at best if $x$ can be negative ...
– Henning Makholm
Jun 13 '16 at 23:07
+1 Thanks, this is a resourceful answer because you referenced Kronecker Delta which was great to read about and see some of the sigma-notated and integral-notated versions of it. As for the piece-wise function, unfortunately I'm working on applying this function into a larger function to simplify the super-function, I can't simplify using a piece-wise function because identities don't exist for custom piece-wise functions and therefor it's hard to cancel stuff out.
– Albert Renshaw
Jun 14 '16 at 4:43
Also for the sinc(πx) only wokring when x is an integer, we can just use floor or ceiling function on x to get it working for all values of x, that's a great answer too for what I'm trying to do except when I look at the definition of sinc, it seems to be piece-wise too, doh
– Albert Renshaw
Jun 14 '16 at 4:44
@Henning, since you mention it: have you already seen Knuth's article on notations? There is a mention of the interesting history of $0^x$ in there...
– J. M. is not a mathematician
Jun 15 '16 at 18:04
|
show 2 more comments
You've already defined your function (assuming you've also chosen its domain).
One of the main ways to "create" a function is simply by specifying its values at all points, and your description has done so.
Typical notation for a function created by the sort of description you give is a definition by cases:
$$ f(x) := begin{cases} 0 & x = 0 \ 1 & x neq 0 end{cases} $$
For many applications — most applications, I expect — this is one of the best descriptions of said function. If need be, name it with a letter, and continue on with whatever you're doing.
The complementary function
$$ g(x) := begin{cases} 1 & x = 0 \ 0 & x neq 0 end{cases} $$
which is related to your function by $f(x) = 1 - g(x)$ comes up often enough in some contexts to have been given a name and notation: e.g.
- The Kronecker delta. A few different notations exist depending on the setting; e.g. $delta_x$, $delta[x]$, or $delta_{x,0}$.
- The Iverson bracket. This would be notated $[x = 0]$. This notation is, IMO, indispensable for doing complicated calculations with summations.
x == 0
computes this function inC
andC++
, and many other programming languages allow similar.
Some applications might want to represent such a function in particular ways. For example, if one only cares about the value of $g(x)$ when $x$ is an integer, but strongly prefers to work with analytic functions (e.g. because you're studying a sequence using complex analysis), one has the fact that
$$ g(x) = mathop{mathrm{sinc}}(pi x) $$
holds whenever $x$ is an integer.
(if you're unfamiliar with it, $mathop{mathrm{sinc}}(z)$ is the continuous extension of $sin(z) / z$)
You've already defined your function (assuming you've also chosen its domain).
One of the main ways to "create" a function is simply by specifying its values at all points, and your description has done so.
Typical notation for a function created by the sort of description you give is a definition by cases:
$$ f(x) := begin{cases} 0 & x = 0 \ 1 & x neq 0 end{cases} $$
For many applications — most applications, I expect — this is one of the best descriptions of said function. If need be, name it with a letter, and continue on with whatever you're doing.
The complementary function
$$ g(x) := begin{cases} 1 & x = 0 \ 0 & x neq 0 end{cases} $$
which is related to your function by $f(x) = 1 - g(x)$ comes up often enough in some contexts to have been given a name and notation: e.g.
- The Kronecker delta. A few different notations exist depending on the setting; e.g. $delta_x$, $delta[x]$, or $delta_{x,0}$.
- The Iverson bracket. This would be notated $[x = 0]$. This notation is, IMO, indispensable for doing complicated calculations with summations.
x == 0
computes this function inC
andC++
, and many other programming languages allow similar.
Some applications might want to represent such a function in particular ways. For example, if one only cares about the value of $g(x)$ when $x$ is an integer, but strongly prefers to work with analytic functions (e.g. because you're studying a sequence using complex analysis), one has the fact that
$$ g(x) = mathop{mathrm{sinc}}(pi x) $$
holds whenever $x$ is an integer.
(if you're unfamiliar with it, $mathop{mathrm{sinc}}(z)$ is the continuous extension of $sin(z) / z$)
edited Jun 13 '16 at 23:57
answered Jun 13 '16 at 22:38
Hurkyl
111k9117259
111k9117259
1
In some settings, $0^x$ could be used as another notation for this, but would likely look out of place.
– Hurkyl
Jun 13 '16 at 22:45
2
$0^x$ would be iffy at best if $x$ can be negative ...
– Henning Makholm
Jun 13 '16 at 23:07
+1 Thanks, this is a resourceful answer because you referenced Kronecker Delta which was great to read about and see some of the sigma-notated and integral-notated versions of it. As for the piece-wise function, unfortunately I'm working on applying this function into a larger function to simplify the super-function, I can't simplify using a piece-wise function because identities don't exist for custom piece-wise functions and therefor it's hard to cancel stuff out.
– Albert Renshaw
Jun 14 '16 at 4:43
Also for the sinc(πx) only wokring when x is an integer, we can just use floor or ceiling function on x to get it working for all values of x, that's a great answer too for what I'm trying to do except when I look at the definition of sinc, it seems to be piece-wise too, doh
– Albert Renshaw
Jun 14 '16 at 4:44
@Henning, since you mention it: have you already seen Knuth's article on notations? There is a mention of the interesting history of $0^x$ in there...
– J. M. is not a mathematician
Jun 15 '16 at 18:04
|
show 2 more comments
1
In some settings, $0^x$ could be used as another notation for this, but would likely look out of place.
– Hurkyl
Jun 13 '16 at 22:45
2
$0^x$ would be iffy at best if $x$ can be negative ...
– Henning Makholm
Jun 13 '16 at 23:07
+1 Thanks, this is a resourceful answer because you referenced Kronecker Delta which was great to read about and see some of the sigma-notated and integral-notated versions of it. As for the piece-wise function, unfortunately I'm working on applying this function into a larger function to simplify the super-function, I can't simplify using a piece-wise function because identities don't exist for custom piece-wise functions and therefor it's hard to cancel stuff out.
– Albert Renshaw
Jun 14 '16 at 4:43
Also for the sinc(πx) only wokring when x is an integer, we can just use floor or ceiling function on x to get it working for all values of x, that's a great answer too for what I'm trying to do except when I look at the definition of sinc, it seems to be piece-wise too, doh
– Albert Renshaw
Jun 14 '16 at 4:44
@Henning, since you mention it: have you already seen Knuth's article on notations? There is a mention of the interesting history of $0^x$ in there...
– J. M. is not a mathematician
Jun 15 '16 at 18:04
1
1
In some settings, $0^x$ could be used as another notation for this, but would likely look out of place.
– Hurkyl
Jun 13 '16 at 22:45
In some settings, $0^x$ could be used as another notation for this, but would likely look out of place.
– Hurkyl
Jun 13 '16 at 22:45
2
2
$0^x$ would be iffy at best if $x$ can be negative ...
– Henning Makholm
Jun 13 '16 at 23:07
$0^x$ would be iffy at best if $x$ can be negative ...
– Henning Makholm
Jun 13 '16 at 23:07
+1 Thanks, this is a resourceful answer because you referenced Kronecker Delta which was great to read about and see some of the sigma-notated and integral-notated versions of it. As for the piece-wise function, unfortunately I'm working on applying this function into a larger function to simplify the super-function, I can't simplify using a piece-wise function because identities don't exist for custom piece-wise functions and therefor it's hard to cancel stuff out.
– Albert Renshaw
Jun 14 '16 at 4:43
+1 Thanks, this is a resourceful answer because you referenced Kronecker Delta which was great to read about and see some of the sigma-notated and integral-notated versions of it. As for the piece-wise function, unfortunately I'm working on applying this function into a larger function to simplify the super-function, I can't simplify using a piece-wise function because identities don't exist for custom piece-wise functions and therefor it's hard to cancel stuff out.
– Albert Renshaw
Jun 14 '16 at 4:43
Also for the sinc(πx) only wokring when x is an integer, we can just use floor or ceiling function on x to get it working for all values of x, that's a great answer too for what I'm trying to do except when I look at the definition of sinc, it seems to be piece-wise too, doh
– Albert Renshaw
Jun 14 '16 at 4:44
Also for the sinc(πx) only wokring when x is an integer, we can just use floor or ceiling function on x to get it working for all values of x, that's a great answer too for what I'm trying to do except when I look at the definition of sinc, it seems to be piece-wise too, doh
– Albert Renshaw
Jun 14 '16 at 4:44
@Henning, since you mention it: have you already seen Knuth's article on notations? There is a mention of the interesting history of $0^x$ in there...
– J. M. is not a mathematician
Jun 15 '16 at 18:04
@Henning, since you mention it: have you already seen Knuth's article on notations? There is a mention of the interesting history of $0^x$ in there...
– J. M. is not a mathematician
Jun 15 '16 at 18:04
|
show 2 more comments
How about $f(x)= 1-delta_{x,0}$ (using the Kronecker Delta function, in Mathematica/WolframAlpha can write the $delta_{x,0}$ as
kroneckerdelta(x,0)
)
add a comment |
How about $f(x)= 1-delta_{x,0}$ (using the Kronecker Delta function, in Mathematica/WolframAlpha can write the $delta_{x,0}$ as
kroneckerdelta(x,0)
)
add a comment |
How about $f(x)= 1-delta_{x,0}$ (using the Kronecker Delta function, in Mathematica/WolframAlpha can write the $delta_{x,0}$ as
kroneckerdelta(x,0)
)
How about $f(x)= 1-delta_{x,0}$ (using the Kronecker Delta function, in Mathematica/WolframAlpha can write the $delta_{x,0}$ as
kroneckerdelta(x,0)
)
edited Jun 13 '16 at 22:20
answered Jun 13 '16 at 22:07
David_Shmij
368217
368217
add a comment |
add a comment |
Here's one using $sum$ notation although it only works for the natural numbers:
$f(x) = sumlimits_{i = 1}^{x}{frac{1}{x}} $
Due to the empty sum being 0.
It can't be simplified to $f(x) = x times frac{1}{x}$ because then f(0) would be undefined.
1
I think this satisfies the0 when x=0
part but what about the1 otherwise
part? Is there something I do, with x, to f(x), after to get to 1 every time?
– Albert Renshaw
Oct 21 at 4:12
1
When $x = 1$ it's just $frac{1}{1}$, when $x = 2$ it's $frac{1}{2} + frac{1}{2}$ which is $frac{2}{2}$ which is 1, in general it's $frac{1}{n} + frac{1}{n} + ... + frac{1}{n}$ repeated $n$ times, which is simply $frac{n}{n}$ which is $1$
– omer
Oct 21 at 16:23
Oh I'm sorry! I wrote $n$ instead of $x$. I'll edit it. Should make more sense now
– omer
Oct 21 at 16:35
add a comment |
Here's one using $sum$ notation although it only works for the natural numbers:
$f(x) = sumlimits_{i = 1}^{x}{frac{1}{x}} $
Due to the empty sum being 0.
It can't be simplified to $f(x) = x times frac{1}{x}$ because then f(0) would be undefined.
1
I think this satisfies the0 when x=0
part but what about the1 otherwise
part? Is there something I do, with x, to f(x), after to get to 1 every time?
– Albert Renshaw
Oct 21 at 4:12
1
When $x = 1$ it's just $frac{1}{1}$, when $x = 2$ it's $frac{1}{2} + frac{1}{2}$ which is $frac{2}{2}$ which is 1, in general it's $frac{1}{n} + frac{1}{n} + ... + frac{1}{n}$ repeated $n$ times, which is simply $frac{n}{n}$ which is $1$
– omer
Oct 21 at 16:23
Oh I'm sorry! I wrote $n$ instead of $x$. I'll edit it. Should make more sense now
– omer
Oct 21 at 16:35
add a comment |
Here's one using $sum$ notation although it only works for the natural numbers:
$f(x) = sumlimits_{i = 1}^{x}{frac{1}{x}} $
Due to the empty sum being 0.
It can't be simplified to $f(x) = x times frac{1}{x}$ because then f(0) would be undefined.
Here's one using $sum$ notation although it only works for the natural numbers:
$f(x) = sumlimits_{i = 1}^{x}{frac{1}{x}} $
Due to the empty sum being 0.
It can't be simplified to $f(x) = x times frac{1}{x}$ because then f(0) would be undefined.
edited Oct 21 at 16:35
answered Oct 20 at 17:32
omer
1495
1495
1
I think this satisfies the0 when x=0
part but what about the1 otherwise
part? Is there something I do, with x, to f(x), after to get to 1 every time?
– Albert Renshaw
Oct 21 at 4:12
1
When $x = 1$ it's just $frac{1}{1}$, when $x = 2$ it's $frac{1}{2} + frac{1}{2}$ which is $frac{2}{2}$ which is 1, in general it's $frac{1}{n} + frac{1}{n} + ... + frac{1}{n}$ repeated $n$ times, which is simply $frac{n}{n}$ which is $1$
– omer
Oct 21 at 16:23
Oh I'm sorry! I wrote $n$ instead of $x$. I'll edit it. Should make more sense now
– omer
Oct 21 at 16:35
add a comment |
1
I think this satisfies the0 when x=0
part but what about the1 otherwise
part? Is there something I do, with x, to f(x), after to get to 1 every time?
– Albert Renshaw
Oct 21 at 4:12
1
When $x = 1$ it's just $frac{1}{1}$, when $x = 2$ it's $frac{1}{2} + frac{1}{2}$ which is $frac{2}{2}$ which is 1, in general it's $frac{1}{n} + frac{1}{n} + ... + frac{1}{n}$ repeated $n$ times, which is simply $frac{n}{n}$ which is $1$
– omer
Oct 21 at 16:23
Oh I'm sorry! I wrote $n$ instead of $x$. I'll edit it. Should make more sense now
– omer
Oct 21 at 16:35
1
1
I think this satisfies the
0 when x=0
part but what about the 1 otherwise
part? Is there something I do, with x, to f(x), after to get to 1 every time?– Albert Renshaw
Oct 21 at 4:12
I think this satisfies the
0 when x=0
part but what about the 1 otherwise
part? Is there something I do, with x, to f(x), after to get to 1 every time?– Albert Renshaw
Oct 21 at 4:12
1
1
When $x = 1$ it's just $frac{1}{1}$, when $x = 2$ it's $frac{1}{2} + frac{1}{2}$ which is $frac{2}{2}$ which is 1, in general it's $frac{1}{n} + frac{1}{n} + ... + frac{1}{n}$ repeated $n$ times, which is simply $frac{n}{n}$ which is $1$
– omer
Oct 21 at 16:23
When $x = 1$ it's just $frac{1}{1}$, when $x = 2$ it's $frac{1}{2} + frac{1}{2}$ which is $frac{2}{2}$ which is 1, in general it's $frac{1}{n} + frac{1}{n} + ... + frac{1}{n}$ repeated $n$ times, which is simply $frac{n}{n}$ which is $1$
– omer
Oct 21 at 16:23
Oh I'm sorry! I wrote $n$ instead of $x$. I'll edit it. Should make more sense now
– omer
Oct 21 at 16:35
Oh I'm sorry! I wrote $n$ instead of $x$. I'll edit it. Should make more sense now
– omer
Oct 21 at 16:35
add a comment |
Without using floor or ceiling it can be done with limits. Start with a function of this form:
$$lim_{c to infty} left (frac{y}{sqrt2}-frac{(xcdot c)}{sqrt2} = sqrt[3]{1-left ( frac{y}{sqrt2}+frac{(xcdot c)}{sqrt2} right )^3 } right )$$
(Note: Using real-valued root not principal root)
This infinitely squashes (along x-axis) a 45º rotated graph of the form $x^3+y^3=1$ which causes the output values to be $0$ everywhere and $sqrt[6]{2}$ at $0$. This can now easily be worked to achieve the desired affect by dividing by $sqrt[6]{2}$ and subtracting from $1$
add a comment |
Without using floor or ceiling it can be done with limits. Start with a function of this form:
$$lim_{c to infty} left (frac{y}{sqrt2}-frac{(xcdot c)}{sqrt2} = sqrt[3]{1-left ( frac{y}{sqrt2}+frac{(xcdot c)}{sqrt2} right )^3 } right )$$
(Note: Using real-valued root not principal root)
This infinitely squashes (along x-axis) a 45º rotated graph of the form $x^3+y^3=1$ which causes the output values to be $0$ everywhere and $sqrt[6]{2}$ at $0$. This can now easily be worked to achieve the desired affect by dividing by $sqrt[6]{2}$ and subtracting from $1$
add a comment |
Without using floor or ceiling it can be done with limits. Start with a function of this form:
$$lim_{c to infty} left (frac{y}{sqrt2}-frac{(xcdot c)}{sqrt2} = sqrt[3]{1-left ( frac{y}{sqrt2}+frac{(xcdot c)}{sqrt2} right )^3 } right )$$
(Note: Using real-valued root not principal root)
This infinitely squashes (along x-axis) a 45º rotated graph of the form $x^3+y^3=1$ which causes the output values to be $0$ everywhere and $sqrt[6]{2}$ at $0$. This can now easily be worked to achieve the desired affect by dividing by $sqrt[6]{2}$ and subtracting from $1$
Without using floor or ceiling it can be done with limits. Start with a function of this form:
$$lim_{c to infty} left (frac{y}{sqrt2}-frac{(xcdot c)}{sqrt2} = sqrt[3]{1-left ( frac{y}{sqrt2}+frac{(xcdot c)}{sqrt2} right )^3 } right )$$
(Note: Using real-valued root not principal root)
This infinitely squashes (along x-axis) a 45º rotated graph of the form $x^3+y^3=1$ which causes the output values to be $0$ everywhere and $sqrt[6]{2}$ at $0$. This can now easily be worked to achieve the desired affect by dividing by $sqrt[6]{2}$ and subtracting from $1$
edited Dec 17 at 18:12
answered Dec 17 at 10:27
Albert Renshaw
7271627
7271627
add a comment |
add a comment |
The following equation I’ve made works without using ceiling function or limits or infinite sums when plotting the real values. 1 at x=0 and 0 and a complex pair counterpart at all other values for x
$(y-1-sqrt{x}-sqrt{-x})cdotfrac{y}{y-x}=0$
This can then be inverted to a less elegant form to have 0 for x=0 and 1 in all other places.
I like this best because it’s pure closed form expression and doesn’t involve any elements like ceiling function that are hard to work with when using this in other places. However it only works if you ignore complex answers which has problems of its own, but still is noteworthy and has application
add a comment |
The following equation I’ve made works without using ceiling function or limits or infinite sums when plotting the real values. 1 at x=0 and 0 and a complex pair counterpart at all other values for x
$(y-1-sqrt{x}-sqrt{-x})cdotfrac{y}{y-x}=0$
This can then be inverted to a less elegant form to have 0 for x=0 and 1 in all other places.
I like this best because it’s pure closed form expression and doesn’t involve any elements like ceiling function that are hard to work with when using this in other places. However it only works if you ignore complex answers which has problems of its own, but still is noteworthy and has application
add a comment |
The following equation I’ve made works without using ceiling function or limits or infinite sums when plotting the real values. 1 at x=0 and 0 and a complex pair counterpart at all other values for x
$(y-1-sqrt{x}-sqrt{-x})cdotfrac{y}{y-x}=0$
This can then be inverted to a less elegant form to have 0 for x=0 and 1 in all other places.
I like this best because it’s pure closed form expression and doesn’t involve any elements like ceiling function that are hard to work with when using this in other places. However it only works if you ignore complex answers which has problems of its own, but still is noteworthy and has application
The following equation I’ve made works without using ceiling function or limits or infinite sums when plotting the real values. 1 at x=0 and 0 and a complex pair counterpart at all other values for x
$(y-1-sqrt{x}-sqrt{-x})cdotfrac{y}{y-x}=0$
This can then be inverted to a less elegant form to have 0 for x=0 and 1 in all other places.
I like this best because it’s pure closed form expression and doesn’t involve any elements like ceiling function that are hard to work with when using this in other places. However it only works if you ignore complex answers which has problems of its own, but still is noteworthy and has application
edited 2 days ago
answered 2 days ago
Albert Renshaw
7271627
7271627
add a comment |
add a comment |
The following equation I've made is a closed-form expression of KroneckerDelta (j=0 form) which will evaluate y=1 at x=0 and y=0 for x≠0.
$$(frac{y}{y-x})cdot((y-1)^2+x^2)=0$$
This function can be subtracted from 1 to achieve the desired result
The function was formed by taking the function for a horizontal line at 0, divided by a 45º line (y=x) through the origin to create a hole in the function at x=0, then multiplied by a circle with radius 0 whose origin is at (0,1) to create a point at (0,1).
add a comment |
The following equation I've made is a closed-form expression of KroneckerDelta (j=0 form) which will evaluate y=1 at x=0 and y=0 for x≠0.
$$(frac{y}{y-x})cdot((y-1)^2+x^2)=0$$
This function can be subtracted from 1 to achieve the desired result
The function was formed by taking the function for a horizontal line at 0, divided by a 45º line (y=x) through the origin to create a hole in the function at x=0, then multiplied by a circle with radius 0 whose origin is at (0,1) to create a point at (0,1).
add a comment |
The following equation I've made is a closed-form expression of KroneckerDelta (j=0 form) which will evaluate y=1 at x=0 and y=0 for x≠0.
$$(frac{y}{y-x})cdot((y-1)^2+x^2)=0$$
This function can be subtracted from 1 to achieve the desired result
The function was formed by taking the function for a horizontal line at 0, divided by a 45º line (y=x) through the origin to create a hole in the function at x=0, then multiplied by a circle with radius 0 whose origin is at (0,1) to create a point at (0,1).
The following equation I've made is a closed-form expression of KroneckerDelta (j=0 form) which will evaluate y=1 at x=0 and y=0 for x≠0.
$$(frac{y}{y-x})cdot((y-1)^2+x^2)=0$$
This function can be subtracted from 1 to achieve the desired result
The function was formed by taking the function for a horizontal line at 0, divided by a 45º line (y=x) through the origin to create a hole in the function at x=0, then multiplied by a circle with radius 0 whose origin is at (0,1) to create a point at (0,1).
answered 2 days ago
Albert Renshaw
7271627
7271627
add a comment |
add a comment |
Paw88789's answer worked great for what I'm trying to do; the only issue was that it didn't work for all "numbers"; some imaginary numbers would cause division by 0. Luckily tonight I was able to create a function that produced the desired result for all numbers, including imaginary/complex.
$f(x) = left lceil frac{1}{2Gamma left ( left | x right | right )} right rceil$
*Note the absolute value inside of Gamma, as it's easy to go unnoticed
add a comment |
Paw88789's answer worked great for what I'm trying to do; the only issue was that it didn't work for all "numbers"; some imaginary numbers would cause division by 0. Luckily tonight I was able to create a function that produced the desired result for all numbers, including imaginary/complex.
$f(x) = left lceil frac{1}{2Gamma left ( left | x right | right )} right rceil$
*Note the absolute value inside of Gamma, as it's easy to go unnoticed
add a comment |
Paw88789's answer worked great for what I'm trying to do; the only issue was that it didn't work for all "numbers"; some imaginary numbers would cause division by 0. Luckily tonight I was able to create a function that produced the desired result for all numbers, including imaginary/complex.
$f(x) = left lceil frac{1}{2Gamma left ( left | x right | right )} right rceil$
*Note the absolute value inside of Gamma, as it's easy to go unnoticed
Paw88789's answer worked great for what I'm trying to do; the only issue was that it didn't work for all "numbers"; some imaginary numbers would cause division by 0. Luckily tonight I was able to create a function that produced the desired result for all numbers, including imaginary/complex.
$f(x) = left lceil frac{1}{2Gamma left ( left | x right | right )} right rceil$
*Note the absolute value inside of Gamma, as it's easy to go unnoticed
edited Apr 13 '17 at 12:20
Community♦
1
1
answered Jun 14 '16 at 4:54
Albert Renshaw
7271627
7271627
add a comment |
add a comment |
Thanks for contributing an answer to Mathematics Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f1825057%2ffx-0-when-x-is-0-and-1-otherwise%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
9
This will do: $$f(x)=begin{cases}0,&x=0\{}1,&xneq 0end{cases}$$
– DonAntonio
Jun 13 '16 at 21:59
1
Perhaps $f(x)=|text{sgn}(x)|$ or $f(x)=text{sgn}(x)^2$ using the absolute value or square of the sign function
– Henry
Jun 13 '16 at 22:03
@David_Shmij: That is a combination of elementary function, namely the constant function $0$ and the constant function $1$ (which are both pretty elementary)!
– Henning Makholm
Jun 13 '16 at 22:05
1
@David_Shmij: Which programming language are you talking about here? Most I know will allow you to write either
x==0?0:1
or something likeif x=0 then 0 else 1
, which both seem pretty easy to me.– Henning Makholm
Jun 13 '16 at 22:17
@David_Shmij: Wolfram's syntax is slightly bizzarre, but you can write
Piecewise[{{0,x=0}},1]
and then multiply by $5$ to your heart's content. Example here.– Henning Makholm
Jun 13 '16 at 23:05