Function problem with Sigma summation

The name of the pictureThe name of the pictureThe name of the pictureClash 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):




enter image description here







share|cite|improve this question





















  • 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














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):




enter image description here







share|cite|improve this question





















  • 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












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):




enter image description here







share|cite|improve this question














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):




enter image description here









share|cite|improve this question












share|cite|improve this question




share|cite|improve this question








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
















  • 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










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).






share|cite|improve this answer























  • 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










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',
convertImagesToLinks: true,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);








 

draft saved


draft discarded


















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






























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).






share|cite|improve this answer























  • 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














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).






share|cite|improve this answer























  • 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












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).






share|cite|improve this answer















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).







share|cite|improve this answer















share|cite|improve this answer



share|cite|improve this answer








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
















  • 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












 

draft saved


draft discarded


























 


draft saved


draft discarded














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













































































Comments

Popular posts from this blog

What is the equation of a 3D cone with generalised tilt?

Color the edges and diagonals of a regular polygon

Relationship between determinant of matrix and determinant of adjoint?