Find the binary input function given the outputs
$begingroup$
Here we have three binary variables $x_1$, $x_2$, $x_3$ $in {0,1}$.
I want to find the form of the function $f(x_1, x_2, x_3)$ such that the following are satisfied:
if $ x_1 = 0, x_2 = 0, x_3 = 0 $ then $ f(x_1, x_2, x_3) = 0$
if $ x_1 = 0, x_2 = 0, x_3 = 1 $ then $ f(x_1, x_2, x_3) = 3$
if $ x_1 = 0, x_2 = 1, x_3 = 0 $ then $ f(x_1, x_2, x_3) = 2$
if $ x_1 = 0, x_2 = 1, x_3 = 1 $ then $ f(x_1, x_2, x_3) = 3$
if $ x_1 = 1, x_2 = 0, x_3 = 0 $ then $ f(x_1, x_2, x_3) = 1$
if $ x_1 = 1, x_2 = 0, x_3 = 1 $ then $ f(x_1, x_2, x_3) = 3$
if $ x_1 = 1, x_2 = 1, x_3 = 0 $ then $ f(x_1, x_2, x_3) = 2$
if $ x_1 = 1, x_2 = 1, x_3 = 1 $ then $ f(x_1, x_2, x_3) = 3$
I imagine it like having a "virtual sum" which is increased by one each step in the sequence. Every time I see a one, this virtual sum "becomes real" and is zeroed. For instance:
$ x_1 = 0, x_2 = 0, x_3 = 1 $. After seeing the first zero the virtual sum is 1. After the second zero the virtual sum is 2. Finally there is a one, so the virtual sum becomes 3 and is reset. The final result is 3.
$ x_1 = 0, x_2 = 0, x_3 = 0 $ We have three zero, so the virtual sum is 3 at the end of the sequence. However, since there are no ones it does not "become real" and the result is 0.
In the two variables case it is enough to write $f(x_1, x_2) = x_1 + x_2$, but in higher dimensions things start to become more difficult.
combinatorics binary binary-operations
$endgroup$
add a comment |
$begingroup$
Here we have three binary variables $x_1$, $x_2$, $x_3$ $in {0,1}$.
I want to find the form of the function $f(x_1, x_2, x_3)$ such that the following are satisfied:
if $ x_1 = 0, x_2 = 0, x_3 = 0 $ then $ f(x_1, x_2, x_3) = 0$
if $ x_1 = 0, x_2 = 0, x_3 = 1 $ then $ f(x_1, x_2, x_3) = 3$
if $ x_1 = 0, x_2 = 1, x_3 = 0 $ then $ f(x_1, x_2, x_3) = 2$
if $ x_1 = 0, x_2 = 1, x_3 = 1 $ then $ f(x_1, x_2, x_3) = 3$
if $ x_1 = 1, x_2 = 0, x_3 = 0 $ then $ f(x_1, x_2, x_3) = 1$
if $ x_1 = 1, x_2 = 0, x_3 = 1 $ then $ f(x_1, x_2, x_3) = 3$
if $ x_1 = 1, x_2 = 1, x_3 = 0 $ then $ f(x_1, x_2, x_3) = 2$
if $ x_1 = 1, x_2 = 1, x_3 = 1 $ then $ f(x_1, x_2, x_3) = 3$
I imagine it like having a "virtual sum" which is increased by one each step in the sequence. Every time I see a one, this virtual sum "becomes real" and is zeroed. For instance:
$ x_1 = 0, x_2 = 0, x_3 = 1 $. After seeing the first zero the virtual sum is 1. After the second zero the virtual sum is 2. Finally there is a one, so the virtual sum becomes 3 and is reset. The final result is 3.
$ x_1 = 0, x_2 = 0, x_3 = 0 $ We have three zero, so the virtual sum is 3 at the end of the sequence. However, since there are no ones it does not "become real" and the result is 0.
In the two variables case it is enough to write $f(x_1, x_2) = x_1 + x_2$, but in higher dimensions things start to become more difficult.
combinatorics binary binary-operations
$endgroup$
add a comment |
$begingroup$
Here we have three binary variables $x_1$, $x_2$, $x_3$ $in {0,1}$.
I want to find the form of the function $f(x_1, x_2, x_3)$ such that the following are satisfied:
if $ x_1 = 0, x_2 = 0, x_3 = 0 $ then $ f(x_1, x_2, x_3) = 0$
if $ x_1 = 0, x_2 = 0, x_3 = 1 $ then $ f(x_1, x_2, x_3) = 3$
if $ x_1 = 0, x_2 = 1, x_3 = 0 $ then $ f(x_1, x_2, x_3) = 2$
if $ x_1 = 0, x_2 = 1, x_3 = 1 $ then $ f(x_1, x_2, x_3) = 3$
if $ x_1 = 1, x_2 = 0, x_3 = 0 $ then $ f(x_1, x_2, x_3) = 1$
if $ x_1 = 1, x_2 = 0, x_3 = 1 $ then $ f(x_1, x_2, x_3) = 3$
if $ x_1 = 1, x_2 = 1, x_3 = 0 $ then $ f(x_1, x_2, x_3) = 2$
if $ x_1 = 1, x_2 = 1, x_3 = 1 $ then $ f(x_1, x_2, x_3) = 3$
I imagine it like having a "virtual sum" which is increased by one each step in the sequence. Every time I see a one, this virtual sum "becomes real" and is zeroed. For instance:
$ x_1 = 0, x_2 = 0, x_3 = 1 $. After seeing the first zero the virtual sum is 1. After the second zero the virtual sum is 2. Finally there is a one, so the virtual sum becomes 3 and is reset. The final result is 3.
$ x_1 = 0, x_2 = 0, x_3 = 0 $ We have three zero, so the virtual sum is 3 at the end of the sequence. However, since there are no ones it does not "become real" and the result is 0.
In the two variables case it is enough to write $f(x_1, x_2) = x_1 + x_2$, but in higher dimensions things start to become more difficult.
combinatorics binary binary-operations
$endgroup$
Here we have three binary variables $x_1$, $x_2$, $x_3$ $in {0,1}$.
I want to find the form of the function $f(x_1, x_2, x_3)$ such that the following are satisfied:
if $ x_1 = 0, x_2 = 0, x_3 = 0 $ then $ f(x_1, x_2, x_3) = 0$
if $ x_1 = 0, x_2 = 0, x_3 = 1 $ then $ f(x_1, x_2, x_3) = 3$
if $ x_1 = 0, x_2 = 1, x_3 = 0 $ then $ f(x_1, x_2, x_3) = 2$
if $ x_1 = 0, x_2 = 1, x_3 = 1 $ then $ f(x_1, x_2, x_3) = 3$
if $ x_1 = 1, x_2 = 0, x_3 = 0 $ then $ f(x_1, x_2, x_3) = 1$
if $ x_1 = 1, x_2 = 0, x_3 = 1 $ then $ f(x_1, x_2, x_3) = 3$
if $ x_1 = 1, x_2 = 1, x_3 = 0 $ then $ f(x_1, x_2, x_3) = 2$
if $ x_1 = 1, x_2 = 1, x_3 = 1 $ then $ f(x_1, x_2, x_3) = 3$
I imagine it like having a "virtual sum" which is increased by one each step in the sequence. Every time I see a one, this virtual sum "becomes real" and is zeroed. For instance:
$ x_1 = 0, x_2 = 0, x_3 = 1 $. After seeing the first zero the virtual sum is 1. After the second zero the virtual sum is 2. Finally there is a one, so the virtual sum becomes 3 and is reset. The final result is 3.
$ x_1 = 0, x_2 = 0, x_3 = 0 $ We have three zero, so the virtual sum is 3 at the end of the sequence. However, since there are no ones it does not "become real" and the result is 0.
In the two variables case it is enough to write $f(x_1, x_2) = x_1 + x_2$, but in higher dimensions things start to become more difficult.
combinatorics binary binary-operations
combinatorics binary binary-operations
edited Dec 17 '18 at 21:32
aprospero
asked Dec 17 '18 at 21:08
aprosperoaprospero
103
103
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
$begingroup$
What you are looking for is simply the last bit set.
You can reverse this, and instead count the sequence of zeroes at the end instead. This has a simple pattern:
At least one zero at the end: $(1 - x_3)$.
At least two zeroes at the end: $(1 - x_3)(1 - x_2)$.
At least three zeroes at the end: $(1 - x_3)(1 - x_2)(1 - x_1)$.
So we get our total expression as:
$$3 - (1 - x_3) - (1 - x_3)(1 - x_2) - (1 - x_3)(1 - x_2)(1 - x_1)$$
$endgroup$
add a comment |
$begingroup$
If you sort in ascending order of $f$, you can think $f(x_1, x_2, x_3)$ as the maximum index of the variable on, i.e.
$f(x_1, x_2, x_3)=max{i, :, x_i=1}$
$endgroup$
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%2f3044441%2ffind-the-binary-input-function-given-the-outputs%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
What you are looking for is simply the last bit set.
You can reverse this, and instead count the sequence of zeroes at the end instead. This has a simple pattern:
At least one zero at the end: $(1 - x_3)$.
At least two zeroes at the end: $(1 - x_3)(1 - x_2)$.
At least three zeroes at the end: $(1 - x_3)(1 - x_2)(1 - x_1)$.
So we get our total expression as:
$$3 - (1 - x_3) - (1 - x_3)(1 - x_2) - (1 - x_3)(1 - x_2)(1 - x_1)$$
$endgroup$
add a comment |
$begingroup$
What you are looking for is simply the last bit set.
You can reverse this, and instead count the sequence of zeroes at the end instead. This has a simple pattern:
At least one zero at the end: $(1 - x_3)$.
At least two zeroes at the end: $(1 - x_3)(1 - x_2)$.
At least three zeroes at the end: $(1 - x_3)(1 - x_2)(1 - x_1)$.
So we get our total expression as:
$$3 - (1 - x_3) - (1 - x_3)(1 - x_2) - (1 - x_3)(1 - x_2)(1 - x_1)$$
$endgroup$
add a comment |
$begingroup$
What you are looking for is simply the last bit set.
You can reverse this, and instead count the sequence of zeroes at the end instead. This has a simple pattern:
At least one zero at the end: $(1 - x_3)$.
At least two zeroes at the end: $(1 - x_3)(1 - x_2)$.
At least three zeroes at the end: $(1 - x_3)(1 - x_2)(1 - x_1)$.
So we get our total expression as:
$$3 - (1 - x_3) - (1 - x_3)(1 - x_2) - (1 - x_3)(1 - x_2)(1 - x_1)$$
$endgroup$
What you are looking for is simply the last bit set.
You can reverse this, and instead count the sequence of zeroes at the end instead. This has a simple pattern:
At least one zero at the end: $(1 - x_3)$.
At least two zeroes at the end: $(1 - x_3)(1 - x_2)$.
At least three zeroes at the end: $(1 - x_3)(1 - x_2)(1 - x_1)$.
So we get our total expression as:
$$3 - (1 - x_3) - (1 - x_3)(1 - x_2) - (1 - x_3)(1 - x_2)(1 - x_1)$$
answered Dec 17 '18 at 21:41
orlporlp
7,5791433
7,5791433
add a comment |
add a comment |
$begingroup$
If you sort in ascending order of $f$, you can think $f(x_1, x_2, x_3)$ as the maximum index of the variable on, i.e.
$f(x_1, x_2, x_3)=max{i, :, x_i=1}$
$endgroup$
add a comment |
$begingroup$
If you sort in ascending order of $f$, you can think $f(x_1, x_2, x_3)$ as the maximum index of the variable on, i.e.
$f(x_1, x_2, x_3)=max{i, :, x_i=1}$
$endgroup$
add a comment |
$begingroup$
If you sort in ascending order of $f$, you can think $f(x_1, x_2, x_3)$ as the maximum index of the variable on, i.e.
$f(x_1, x_2, x_3)=max{i, :, x_i=1}$
$endgroup$
If you sort in ascending order of $f$, you can think $f(x_1, x_2, x_3)$ as the maximum index of the variable on, i.e.
$f(x_1, x_2, x_3)=max{i, :, x_i=1}$
answered Dec 17 '18 at 21:52
PiccoloPaoloPiccoloPaolo
413
413
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.
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%2f3044441%2ffind-the-binary-input-function-given-the-outputs%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