Function problem with Sigma summation
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
As a programmer learning how to write math-notation, I want to be able to exit when some function inside the Sigma summation has reached a particular value, but keep the value that the Sigma has computed. In programming this is easy, but not as math notation (unless I have missed something).
Say I have $xinmathbbN$ as bitstring: $x = 1100100110110101_2$ $(=51637_10)$ and I check each pair from right to left: $01$ $01$ $11$ $10$ $01$ $10$ $00$ $11$ using $pmod 4$ I need to make a "counter" function, such that when the pair reaches one of the bitvalues: $11$, $10$ or $00$ the counter stops else increases by $1$.
In decimal this would be equivalent of saying that when $51637 pmod 4$ equals: $3$,$2$ or $0$ the counter should stop else add $1$ and continue.
And on the next iteration we divide $51637$ by $4$ to get $12909$ so: $12909 pmod 4$ equals: $3$,$2$ or 0 counter should stop else add $1$ and continue.
and iterate this procedure until $x = 0$.
So we have the function:
$S(n)=begincases
0 & nequiv 0pmod4 \
1 & nequiv 1pmod4\
0 & nequiv 2pmod4\
0 & nequiv 3pmod4endcases $
The iterative procedure should stop at the first instance of one of these zeros, but keep the value that $S(n)$ has computed along the way.
$S(n)$ has a drawback with this, it does not return after hitting the case: zero. For me it feels like a general barrier (if one could call it that) in all functions though. Or could one use two-dimensional functions to overcome this?
There is no exit-case in sigma-symbol as far as i can tell. The problem is that the "counter" function continues after reaching $3$,$2$ or $0$, but i don't want that.
Are there any solutions to this problem? I also dont know if capital pi notation can be used in the solution or not?
Example
If $c$ is the bitstring length divided by $2$, and $n=51637$, an example would be:
$$Z(n)=sum_i=0^c-1 fracS(n)4^i$$
$Z(n)$ should return the value $3$. But it does not because Sigma has to finish.
Don Fuchs solution seems to give the right answer, if this table is correct (See image below):
functions discrete-mathematics natural-numbers
add a comment |Â
up vote
0
down vote
favorite
As a programmer learning how to write math-notation, I want to be able to exit when some function inside the Sigma summation has reached a particular value, but keep the value that the Sigma has computed. In programming this is easy, but not as math notation (unless I have missed something).
Say I have $xinmathbbN$ as bitstring: $x = 1100100110110101_2$ $(=51637_10)$ and I check each pair from right to left: $01$ $01$ $11$ $10$ $01$ $10$ $00$ $11$ using $pmod 4$ I need to make a "counter" function, such that when the pair reaches one of the bitvalues: $11$, $10$ or $00$ the counter stops else increases by $1$.
In decimal this would be equivalent of saying that when $51637 pmod 4$ equals: $3$,$2$ or $0$ the counter should stop else add $1$ and continue.
And on the next iteration we divide $51637$ by $4$ to get $12909$ so: $12909 pmod 4$ equals: $3$,$2$ or 0 counter should stop else add $1$ and continue.
and iterate this procedure until $x = 0$.
So we have the function:
$S(n)=begincases
0 & nequiv 0pmod4 \
1 & nequiv 1pmod4\
0 & nequiv 2pmod4\
0 & nequiv 3pmod4endcases $
The iterative procedure should stop at the first instance of one of these zeros, but keep the value that $S(n)$ has computed along the way.
$S(n)$ has a drawback with this, it does not return after hitting the case: zero. For me it feels like a general barrier (if one could call it that) in all functions though. Or could one use two-dimensional functions to overcome this?
There is no exit-case in sigma-symbol as far as i can tell. The problem is that the "counter" function continues after reaching $3$,$2$ or $0$, but i don't want that.
Are there any solutions to this problem? I also dont know if capital pi notation can be used in the solution or not?
Example
If $c$ is the bitstring length divided by $2$, and $n=51637$, an example would be:
$$Z(n)=sum_i=0^c-1 fracS(n)4^i$$
$Z(n)$ should return the value $3$. But it does not because Sigma has to finish.
Don Fuchs solution seems to give the right answer, if this table is correct (See image below):
functions discrete-mathematics natural-numbers
Mathematically it seems that "counter stops" is the same as "counter increases by 0."
– John Wayland Bales
8 hours ago
That's true John
– Natural Number Guy
53 mins ago
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
As a programmer learning how to write math-notation, I want to be able to exit when some function inside the Sigma summation has reached a particular value, but keep the value that the Sigma has computed. In programming this is easy, but not as math notation (unless I have missed something).
Say I have $xinmathbbN$ as bitstring: $x = 1100100110110101_2$ $(=51637_10)$ and I check each pair from right to left: $01$ $01$ $11$ $10$ $01$ $10$ $00$ $11$ using $pmod 4$ I need to make a "counter" function, such that when the pair reaches one of the bitvalues: $11$, $10$ or $00$ the counter stops else increases by $1$.
In decimal this would be equivalent of saying that when $51637 pmod 4$ equals: $3$,$2$ or $0$ the counter should stop else add $1$ and continue.
And on the next iteration we divide $51637$ by $4$ to get $12909$ so: $12909 pmod 4$ equals: $3$,$2$ or 0 counter should stop else add $1$ and continue.
and iterate this procedure until $x = 0$.
So we have the function:
$S(n)=begincases
0 & nequiv 0pmod4 \
1 & nequiv 1pmod4\
0 & nequiv 2pmod4\
0 & nequiv 3pmod4endcases $
The iterative procedure should stop at the first instance of one of these zeros, but keep the value that $S(n)$ has computed along the way.
$S(n)$ has a drawback with this, it does not return after hitting the case: zero. For me it feels like a general barrier (if one could call it that) in all functions though. Or could one use two-dimensional functions to overcome this?
There is no exit-case in sigma-symbol as far as i can tell. The problem is that the "counter" function continues after reaching $3$,$2$ or $0$, but i don't want that.
Are there any solutions to this problem? I also dont know if capital pi notation can be used in the solution or not?
Example
If $c$ is the bitstring length divided by $2$, and $n=51637$, an example would be:
$$Z(n)=sum_i=0^c-1 fracS(n)4^i$$
$Z(n)$ should return the value $3$. But it does not because Sigma has to finish.
Don Fuchs solution seems to give the right answer, if this table is correct (See image below):
functions discrete-mathematics natural-numbers
As a programmer learning how to write math-notation, I want to be able to exit when some function inside the Sigma summation has reached a particular value, but keep the value that the Sigma has computed. In programming this is easy, but not as math notation (unless I have missed something).
Say I have $xinmathbbN$ as bitstring: $x = 1100100110110101_2$ $(=51637_10)$ and I check each pair from right to left: $01$ $01$ $11$ $10$ $01$ $10$ $00$ $11$ using $pmod 4$ I need to make a "counter" function, such that when the pair reaches one of the bitvalues: $11$, $10$ or $00$ the counter stops else increases by $1$.
In decimal this would be equivalent of saying that when $51637 pmod 4$ equals: $3$,$2$ or $0$ the counter should stop else add $1$ and continue.
And on the next iteration we divide $51637$ by $4$ to get $12909$ so: $12909 pmod 4$ equals: $3$,$2$ or 0 counter should stop else add $1$ and continue.
and iterate this procedure until $x = 0$.
So we have the function:
$S(n)=begincases
0 & nequiv 0pmod4 \
1 & nequiv 1pmod4\
0 & nequiv 2pmod4\
0 & nequiv 3pmod4endcases $
The iterative procedure should stop at the first instance of one of these zeros, but keep the value that $S(n)$ has computed along the way.
$S(n)$ has a drawback with this, it does not return after hitting the case: zero. For me it feels like a general barrier (if one could call it that) in all functions though. Or could one use two-dimensional functions to overcome this?
There is no exit-case in sigma-symbol as far as i can tell. The problem is that the "counter" function continues after reaching $3$,$2$ or $0$, but i don't want that.
Are there any solutions to this problem? I also dont know if capital pi notation can be used in the solution or not?
Example
If $c$ is the bitstring length divided by $2$, and $n=51637$, an example would be:
$$Z(n)=sum_i=0^c-1 fracS(n)4^i$$
$Z(n)$ should return the value $3$. But it does not because Sigma has to finish.
Don Fuchs solution seems to give the right answer, if this table is correct (See image below):
functions discrete-mathematics natural-numbers
edited 4 hours ago
asked 8 hours ago
Natural Number Guy
366214
366214
Mathematically it seems that "counter stops" is the same as "counter increases by 0."
– John Wayland Bales
8 hours ago
That's true John
– Natural Number Guy
53 mins ago
add a comment |Â
Mathematically it seems that "counter stops" is the same as "counter increases by 0."
– John Wayland Bales
8 hours ago
That's true John
– Natural Number Guy
53 mins ago
Mathematically it seems that "counter stops" is the same as "counter increases by 0."
– John Wayland Bales
8 hours ago
Mathematically it seems that "counter stops" is the same as "counter increases by 0."
– John Wayland Bales
8 hours ago
That's true John
– Natural Number Guy
53 mins ago
That's true John
– Natural Number Guy
53 mins ago
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
1
down vote
Your idea to use a product isn't too bad; I would try
$$
Z(n)=sum_i=0^inftyleft[Sleft(fracn4^iright)prod_j=0^iSleft(fracn4^jright)right].
$$
With the first $i$ such that $S(n/4^i)$ equals $0$ the inner product contains a $0$ factor and therefore is $0$, and remains $0$ even for higher indices $k$ where $S(n/4^k)$ might equal $1$ (it "has a memory").
Also note the divisor $4^i$ dividing the argument of $S$, not $S(n)$ itself, to get your desired iterative structure (if I got you right there).
Can you look at the table I've added to see if I understand your solution is same. Yes I the pi-notation seems correct. I have to be sure I understand it first. And I will accept your answer if so. (And of course I see that I could just add 1 to the whole function to get the answer 3. so thats just a minor problem).
– Natural Number Guy
4 hours ago
And yes, you are right about dividing the argument and not $S(n)$ itself.
– Natural Number Guy
55 mins ago
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
Your idea to use a product isn't too bad; I would try
$$
Z(n)=sum_i=0^inftyleft[Sleft(fracn4^iright)prod_j=0^iSleft(fracn4^jright)right].
$$
With the first $i$ such that $S(n/4^i)$ equals $0$ the inner product contains a $0$ factor and therefore is $0$, and remains $0$ even for higher indices $k$ where $S(n/4^k)$ might equal $1$ (it "has a memory").
Also note the divisor $4^i$ dividing the argument of $S$, not $S(n)$ itself, to get your desired iterative structure (if I got you right there).
Can you look at the table I've added to see if I understand your solution is same. Yes I the pi-notation seems correct. I have to be sure I understand it first. And I will accept your answer if so. (And of course I see that I could just add 1 to the whole function to get the answer 3. so thats just a minor problem).
– Natural Number Guy
4 hours ago
And yes, you are right about dividing the argument and not $S(n)$ itself.
– Natural Number Guy
55 mins ago
add a comment |Â
up vote
1
down vote
Your idea to use a product isn't too bad; I would try
$$
Z(n)=sum_i=0^inftyleft[Sleft(fracn4^iright)prod_j=0^iSleft(fracn4^jright)right].
$$
With the first $i$ such that $S(n/4^i)$ equals $0$ the inner product contains a $0$ factor and therefore is $0$, and remains $0$ even for higher indices $k$ where $S(n/4^k)$ might equal $1$ (it "has a memory").
Also note the divisor $4^i$ dividing the argument of $S$, not $S(n)$ itself, to get your desired iterative structure (if I got you right there).
Can you look at the table I've added to see if I understand your solution is same. Yes I the pi-notation seems correct. I have to be sure I understand it first. And I will accept your answer if so. (And of course I see that I could just add 1 to the whole function to get the answer 3. so thats just a minor problem).
– Natural Number Guy
4 hours ago
And yes, you are right about dividing the argument and not $S(n)$ itself.
– Natural Number Guy
55 mins ago
add a comment |Â
up vote
1
down vote
up vote
1
down vote
Your idea to use a product isn't too bad; I would try
$$
Z(n)=sum_i=0^inftyleft[Sleft(fracn4^iright)prod_j=0^iSleft(fracn4^jright)right].
$$
With the first $i$ such that $S(n/4^i)$ equals $0$ the inner product contains a $0$ factor and therefore is $0$, and remains $0$ even for higher indices $k$ where $S(n/4^k)$ might equal $1$ (it "has a memory").
Also note the divisor $4^i$ dividing the argument of $S$, not $S(n)$ itself, to get your desired iterative structure (if I got you right there).
Your idea to use a product isn't too bad; I would try
$$
Z(n)=sum_i=0^inftyleft[Sleft(fracn4^iright)prod_j=0^iSleft(fracn4^jright)right].
$$
With the first $i$ such that $S(n/4^i)$ equals $0$ the inner product contains a $0$ factor and therefore is $0$, and remains $0$ even for higher indices $k$ where $S(n/4^k)$ might equal $1$ (it "has a memory").
Also note the divisor $4^i$ dividing the argument of $S$, not $S(n)$ itself, to get your desired iterative structure (if I got you right there).
edited 7 hours ago
answered 7 hours ago
Don Fuchs
234
234
Can you look at the table I've added to see if I understand your solution is same. Yes I the pi-notation seems correct. I have to be sure I understand it first. And I will accept your answer if so. (And of course I see that I could just add 1 to the whole function to get the answer 3. so thats just a minor problem).
– Natural Number Guy
4 hours ago
And yes, you are right about dividing the argument and not $S(n)$ itself.
– Natural Number Guy
55 mins ago
add a comment |Â
Can you look at the table I've added to see if I understand your solution is same. Yes I the pi-notation seems correct. I have to be sure I understand it first. And I will accept your answer if so. (And of course I see that I could just add 1 to the whole function to get the answer 3. so thats just a minor problem).
– Natural Number Guy
4 hours ago
And yes, you are right about dividing the argument and not $S(n)$ itself.
– Natural Number Guy
55 mins ago
Can you look at the table I've added to see if I understand your solution is same. Yes I the pi-notation seems correct. I have to be sure I understand it first. And I will accept your answer if so. (And of course I see that I could just add 1 to the whole function to get the answer 3. so thats just a minor problem).
– Natural Number Guy
4 hours ago
Can you look at the table I've added to see if I understand your solution is same. Yes I the pi-notation seems correct. I have to be sure I understand it first. And I will accept your answer if so. (And of course I see that I could just add 1 to the whole function to get the answer 3. so thats just a minor problem).
– Natural Number Guy
4 hours ago
And yes, you are right about dividing the argument and not $S(n)$ itself.
– Natural Number Guy
55 mins ago
And yes, you are right about dividing the argument and not $S(n)$ itself.
– Natural Number Guy
55 mins ago
add a comment |Â
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
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2873084%2ffunction-problem-with-sigma-summation%23new-answer', 'question_page');
);
Post as a guest
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
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
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
Mathematically it seems that "counter stops" is the same as "counter increases by 0."
– John Wayland Bales
8 hours ago
That's true John
– Natural Number Guy
53 mins ago