Expressing a step function

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












Take the interval $I=[0,1]$ and the sequence $x_n_ninBbbN$ defined as follows:



$$x_n=sum_k=1^n frac12^k, forall n in BbbN$$
and $x_0=0$.
Now, that sequence defines a partition for the interval $I$. Let's define the function $f$ such that $f(0)=0, f(1)=1$ and for all other $xin I$, if $x_i-1<xleq x_i$ then $f(x)=x_i$, where $i in BbbN$. This funcion should look like this:



enter image description here



Did I define it correctly? Is there another way to define this function in a more elegant/short way? Bonus points if someone could post a plot of this function where the area "under the curve" is shown!



Edit: Is the area under the function equal to $frac12$?



Thanks in advance!







share|cite|improve this question

















  • 1




    In my experience, step functions are defined so as to only take on finitely many values, so I would hesitate to call that a step function
    – Brevan Ellefsen
    Jul 16 at 5:02










  • As for what you seem to intend... your function appears to be the one which takes an input of $0.a_1a_2a_3a_4a_5dots$ in binary and searches for the left-most occurrence of zero after the decimal point, changes it to a $1$, and truncates all the remaining digits after it. So, for example it would map $0.11colorred01000dots$ to $0.111$ in binary. (interesting to note is that choice of representation issues like $0.011111dots = 0.10000dots$ don't seem to matter here since they both map to the same output anyways).
    – JMoravitz
    Jul 16 at 5:05











  • The rest looks OK to me, at least in that the function you describe matches the picture you have. As for "Did I define it correctly?" - I'm not sure what you mean. Did you define what correctly? If you are asking if your function matches the picture, then yes (except that your picture doesn't have $f(0)=0$ and $f(1)=1$)
    – Brevan Ellefsen
    Jul 16 at 5:05







  • 3




    The summation for the area under the curve: $sumlimits_k=1^infty frac12^k(1-frac12^k)=sumfrac12^k-sumfrac14^k=1-frac13=frac23$
    – JMoravitz
    Jul 16 at 5:11










  • ... and the area under the curve is clearly greater than $frac12$ because all sections of the curve lie above the diagonal line $y=x$.
    – gandalf61
    Jul 16 at 10:24














up vote
0
down vote

favorite












Take the interval $I=[0,1]$ and the sequence $x_n_ninBbbN$ defined as follows:



$$x_n=sum_k=1^n frac12^k, forall n in BbbN$$
and $x_0=0$.
Now, that sequence defines a partition for the interval $I$. Let's define the function $f$ such that $f(0)=0, f(1)=1$ and for all other $xin I$, if $x_i-1<xleq x_i$ then $f(x)=x_i$, where $i in BbbN$. This funcion should look like this:



enter image description here



Did I define it correctly? Is there another way to define this function in a more elegant/short way? Bonus points if someone could post a plot of this function where the area "under the curve" is shown!



Edit: Is the area under the function equal to $frac12$?



Thanks in advance!







share|cite|improve this question

















  • 1




    In my experience, step functions are defined so as to only take on finitely many values, so I would hesitate to call that a step function
    – Brevan Ellefsen
    Jul 16 at 5:02










  • As for what you seem to intend... your function appears to be the one which takes an input of $0.a_1a_2a_3a_4a_5dots$ in binary and searches for the left-most occurrence of zero after the decimal point, changes it to a $1$, and truncates all the remaining digits after it. So, for example it would map $0.11colorred01000dots$ to $0.111$ in binary. (interesting to note is that choice of representation issues like $0.011111dots = 0.10000dots$ don't seem to matter here since they both map to the same output anyways).
    – JMoravitz
    Jul 16 at 5:05











  • The rest looks OK to me, at least in that the function you describe matches the picture you have. As for "Did I define it correctly?" - I'm not sure what you mean. Did you define what correctly? If you are asking if your function matches the picture, then yes (except that your picture doesn't have $f(0)=0$ and $f(1)=1$)
    – Brevan Ellefsen
    Jul 16 at 5:05







  • 3




    The summation for the area under the curve: $sumlimits_k=1^infty frac12^k(1-frac12^k)=sumfrac12^k-sumfrac14^k=1-frac13=frac23$
    – JMoravitz
    Jul 16 at 5:11










  • ... and the area under the curve is clearly greater than $frac12$ because all sections of the curve lie above the diagonal line $y=x$.
    – gandalf61
    Jul 16 at 10:24












up vote
0
down vote

favorite









up vote
0
down vote

favorite











Take the interval $I=[0,1]$ and the sequence $x_n_ninBbbN$ defined as follows:



$$x_n=sum_k=1^n frac12^k, forall n in BbbN$$
and $x_0=0$.
Now, that sequence defines a partition for the interval $I$. Let's define the function $f$ such that $f(0)=0, f(1)=1$ and for all other $xin I$, if $x_i-1<xleq x_i$ then $f(x)=x_i$, where $i in BbbN$. This funcion should look like this:



enter image description here



Did I define it correctly? Is there another way to define this function in a more elegant/short way? Bonus points if someone could post a plot of this function where the area "under the curve" is shown!



Edit: Is the area under the function equal to $frac12$?



Thanks in advance!







share|cite|improve this question













Take the interval $I=[0,1]$ and the sequence $x_n_ninBbbN$ defined as follows:



$$x_n=sum_k=1^n frac12^k, forall n in BbbN$$
and $x_0=0$.
Now, that sequence defines a partition for the interval $I$. Let's define the function $f$ such that $f(0)=0, f(1)=1$ and for all other $xin I$, if $x_i-1<xleq x_i$ then $f(x)=x_i$, where $i in BbbN$. This funcion should look like this:



enter image description here



Did I define it correctly? Is there another way to define this function in a more elegant/short way? Bonus points if someone could post a plot of this function where the area "under the curve" is shown!



Edit: Is the area under the function equal to $frac12$?



Thanks in advance!









share|cite|improve this question












share|cite|improve this question




share|cite|improve this question








edited Jul 16 at 5:05
























asked Jul 16 at 4:59









NotAMathematician

33011




33011







  • 1




    In my experience, step functions are defined so as to only take on finitely many values, so I would hesitate to call that a step function
    – Brevan Ellefsen
    Jul 16 at 5:02










  • As for what you seem to intend... your function appears to be the one which takes an input of $0.a_1a_2a_3a_4a_5dots$ in binary and searches for the left-most occurrence of zero after the decimal point, changes it to a $1$, and truncates all the remaining digits after it. So, for example it would map $0.11colorred01000dots$ to $0.111$ in binary. (interesting to note is that choice of representation issues like $0.011111dots = 0.10000dots$ don't seem to matter here since they both map to the same output anyways).
    – JMoravitz
    Jul 16 at 5:05











  • The rest looks OK to me, at least in that the function you describe matches the picture you have. As for "Did I define it correctly?" - I'm not sure what you mean. Did you define what correctly? If you are asking if your function matches the picture, then yes (except that your picture doesn't have $f(0)=0$ and $f(1)=1$)
    – Brevan Ellefsen
    Jul 16 at 5:05







  • 3




    The summation for the area under the curve: $sumlimits_k=1^infty frac12^k(1-frac12^k)=sumfrac12^k-sumfrac14^k=1-frac13=frac23$
    – JMoravitz
    Jul 16 at 5:11










  • ... and the area under the curve is clearly greater than $frac12$ because all sections of the curve lie above the diagonal line $y=x$.
    – gandalf61
    Jul 16 at 10:24












  • 1




    In my experience, step functions are defined so as to only take on finitely many values, so I would hesitate to call that a step function
    – Brevan Ellefsen
    Jul 16 at 5:02










  • As for what you seem to intend... your function appears to be the one which takes an input of $0.a_1a_2a_3a_4a_5dots$ in binary and searches for the left-most occurrence of zero after the decimal point, changes it to a $1$, and truncates all the remaining digits after it. So, for example it would map $0.11colorred01000dots$ to $0.111$ in binary. (interesting to note is that choice of representation issues like $0.011111dots = 0.10000dots$ don't seem to matter here since they both map to the same output anyways).
    – JMoravitz
    Jul 16 at 5:05











  • The rest looks OK to me, at least in that the function you describe matches the picture you have. As for "Did I define it correctly?" - I'm not sure what you mean. Did you define what correctly? If you are asking if your function matches the picture, then yes (except that your picture doesn't have $f(0)=0$ and $f(1)=1$)
    – Brevan Ellefsen
    Jul 16 at 5:05







  • 3




    The summation for the area under the curve: $sumlimits_k=1^infty frac12^k(1-frac12^k)=sumfrac12^k-sumfrac14^k=1-frac13=frac23$
    – JMoravitz
    Jul 16 at 5:11










  • ... and the area under the curve is clearly greater than $frac12$ because all sections of the curve lie above the diagonal line $y=x$.
    – gandalf61
    Jul 16 at 10:24







1




1




In my experience, step functions are defined so as to only take on finitely many values, so I would hesitate to call that a step function
– Brevan Ellefsen
Jul 16 at 5:02




In my experience, step functions are defined so as to only take on finitely many values, so I would hesitate to call that a step function
– Brevan Ellefsen
Jul 16 at 5:02












As for what you seem to intend... your function appears to be the one which takes an input of $0.a_1a_2a_3a_4a_5dots$ in binary and searches for the left-most occurrence of zero after the decimal point, changes it to a $1$, and truncates all the remaining digits after it. So, for example it would map $0.11colorred01000dots$ to $0.111$ in binary. (interesting to note is that choice of representation issues like $0.011111dots = 0.10000dots$ don't seem to matter here since they both map to the same output anyways).
– JMoravitz
Jul 16 at 5:05





As for what you seem to intend... your function appears to be the one which takes an input of $0.a_1a_2a_3a_4a_5dots$ in binary and searches for the left-most occurrence of zero after the decimal point, changes it to a $1$, and truncates all the remaining digits after it. So, for example it would map $0.11colorred01000dots$ to $0.111$ in binary. (interesting to note is that choice of representation issues like $0.011111dots = 0.10000dots$ don't seem to matter here since they both map to the same output anyways).
– JMoravitz
Jul 16 at 5:05













The rest looks OK to me, at least in that the function you describe matches the picture you have. As for "Did I define it correctly?" - I'm not sure what you mean. Did you define what correctly? If you are asking if your function matches the picture, then yes (except that your picture doesn't have $f(0)=0$ and $f(1)=1$)
– Brevan Ellefsen
Jul 16 at 5:05





The rest looks OK to me, at least in that the function you describe matches the picture you have. As for "Did I define it correctly?" - I'm not sure what you mean. Did you define what correctly? If you are asking if your function matches the picture, then yes (except that your picture doesn't have $f(0)=0$ and $f(1)=1$)
– Brevan Ellefsen
Jul 16 at 5:05





3




3




The summation for the area under the curve: $sumlimits_k=1^infty frac12^k(1-frac12^k)=sumfrac12^k-sumfrac14^k=1-frac13=frac23$
– JMoravitz
Jul 16 at 5:11




The summation for the area under the curve: $sumlimits_k=1^infty frac12^k(1-frac12^k)=sumfrac12^k-sumfrac14^k=1-frac13=frac23$
– JMoravitz
Jul 16 at 5:11












... and the area under the curve is clearly greater than $frac12$ because all sections of the curve lie above the diagonal line $y=x$.
– gandalf61
Jul 16 at 10:24




... and the area under the curve is clearly greater than $frac12$ because all sections of the curve lie above the diagonal line $y=x$.
– gandalf61
Jul 16 at 10:24










1 Answer
1






active

oldest

votes

















up vote
3
down vote



accepted










$$x_n=sum_k=1^n frac12^k=1-frac12^n tag 1$$
$$2^n=frac11-x_n$$
$$n=frac-ln(1-x_n)ln(2) tag 2$$
Eq.$(2)$ is only valid for the discret values of $x$ defined by Eq.$(1)$.



If we want to extend to continuous $x$ we have to use the celling or the floor functions, respectively noted $lceil:rceil$ and $lfloor:rfloor$ :



http://mathworld.wolfram.com/CeilingFunction.html



http://mathworld.wolfram.com/FloorFunction.html



$$n=leftlceilfrac-ln(1-x)ln(2)rightrceil=1+leftlfloorfrac-ln(1-x)ln(2)rightrfloor$$
Thus, the equation represented on your graph is :
$$f(x)=1-frac12^1+leftlfloorfrac-ln(1-x)ln(2)rightrfloor$$



enter image description here



$$A=int_0^1 f(x)dx=sum_n=1^infty f(x_n)(x_n-x_n-1)$$
$$A = sum_k=1^n left(1-frac12^nright)left((1-frac12^n)-(1-frac12^n-1) right) =sum_k=1^n left(1-frac12^nright)frac12^n$$
$$A = sum_k=1^nfrac12^n-sum_k=1^nfrac12^2n=1-frac13$$
$$int_0^1 f(x)dx=frac23$$



enter image description here






share|cite|improve this answer























    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%2f2853109%2fexpressing-a-step-function%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
    3
    down vote



    accepted










    $$x_n=sum_k=1^n frac12^k=1-frac12^n tag 1$$
    $$2^n=frac11-x_n$$
    $$n=frac-ln(1-x_n)ln(2) tag 2$$
    Eq.$(2)$ is only valid for the discret values of $x$ defined by Eq.$(1)$.



    If we want to extend to continuous $x$ we have to use the celling or the floor functions, respectively noted $lceil:rceil$ and $lfloor:rfloor$ :



    http://mathworld.wolfram.com/CeilingFunction.html



    http://mathworld.wolfram.com/FloorFunction.html



    $$n=leftlceilfrac-ln(1-x)ln(2)rightrceil=1+leftlfloorfrac-ln(1-x)ln(2)rightrfloor$$
    Thus, the equation represented on your graph is :
    $$f(x)=1-frac12^1+leftlfloorfrac-ln(1-x)ln(2)rightrfloor$$



    enter image description here



    $$A=int_0^1 f(x)dx=sum_n=1^infty f(x_n)(x_n-x_n-1)$$
    $$A = sum_k=1^n left(1-frac12^nright)left((1-frac12^n)-(1-frac12^n-1) right) =sum_k=1^n left(1-frac12^nright)frac12^n$$
    $$A = sum_k=1^nfrac12^n-sum_k=1^nfrac12^2n=1-frac13$$
    $$int_0^1 f(x)dx=frac23$$



    enter image description here






    share|cite|improve this answer



























      up vote
      3
      down vote



      accepted










      $$x_n=sum_k=1^n frac12^k=1-frac12^n tag 1$$
      $$2^n=frac11-x_n$$
      $$n=frac-ln(1-x_n)ln(2) tag 2$$
      Eq.$(2)$ is only valid for the discret values of $x$ defined by Eq.$(1)$.



      If we want to extend to continuous $x$ we have to use the celling or the floor functions, respectively noted $lceil:rceil$ and $lfloor:rfloor$ :



      http://mathworld.wolfram.com/CeilingFunction.html



      http://mathworld.wolfram.com/FloorFunction.html



      $$n=leftlceilfrac-ln(1-x)ln(2)rightrceil=1+leftlfloorfrac-ln(1-x)ln(2)rightrfloor$$
      Thus, the equation represented on your graph is :
      $$f(x)=1-frac12^1+leftlfloorfrac-ln(1-x)ln(2)rightrfloor$$



      enter image description here



      $$A=int_0^1 f(x)dx=sum_n=1^infty f(x_n)(x_n-x_n-1)$$
      $$A = sum_k=1^n left(1-frac12^nright)left((1-frac12^n)-(1-frac12^n-1) right) =sum_k=1^n left(1-frac12^nright)frac12^n$$
      $$A = sum_k=1^nfrac12^n-sum_k=1^nfrac12^2n=1-frac13$$
      $$int_0^1 f(x)dx=frac23$$



      enter image description here






      share|cite|improve this answer

























        up vote
        3
        down vote



        accepted







        up vote
        3
        down vote



        accepted






        $$x_n=sum_k=1^n frac12^k=1-frac12^n tag 1$$
        $$2^n=frac11-x_n$$
        $$n=frac-ln(1-x_n)ln(2) tag 2$$
        Eq.$(2)$ is only valid for the discret values of $x$ defined by Eq.$(1)$.



        If we want to extend to continuous $x$ we have to use the celling or the floor functions, respectively noted $lceil:rceil$ and $lfloor:rfloor$ :



        http://mathworld.wolfram.com/CeilingFunction.html



        http://mathworld.wolfram.com/FloorFunction.html



        $$n=leftlceilfrac-ln(1-x)ln(2)rightrceil=1+leftlfloorfrac-ln(1-x)ln(2)rightrfloor$$
        Thus, the equation represented on your graph is :
        $$f(x)=1-frac12^1+leftlfloorfrac-ln(1-x)ln(2)rightrfloor$$



        enter image description here



        $$A=int_0^1 f(x)dx=sum_n=1^infty f(x_n)(x_n-x_n-1)$$
        $$A = sum_k=1^n left(1-frac12^nright)left((1-frac12^n)-(1-frac12^n-1) right) =sum_k=1^n left(1-frac12^nright)frac12^n$$
        $$A = sum_k=1^nfrac12^n-sum_k=1^nfrac12^2n=1-frac13$$
        $$int_0^1 f(x)dx=frac23$$



        enter image description here






        share|cite|improve this answer















        $$x_n=sum_k=1^n frac12^k=1-frac12^n tag 1$$
        $$2^n=frac11-x_n$$
        $$n=frac-ln(1-x_n)ln(2) tag 2$$
        Eq.$(2)$ is only valid for the discret values of $x$ defined by Eq.$(1)$.



        If we want to extend to continuous $x$ we have to use the celling or the floor functions, respectively noted $lceil:rceil$ and $lfloor:rfloor$ :



        http://mathworld.wolfram.com/CeilingFunction.html



        http://mathworld.wolfram.com/FloorFunction.html



        $$n=leftlceilfrac-ln(1-x)ln(2)rightrceil=1+leftlfloorfrac-ln(1-x)ln(2)rightrfloor$$
        Thus, the equation represented on your graph is :
        $$f(x)=1-frac12^1+leftlfloorfrac-ln(1-x)ln(2)rightrfloor$$



        enter image description here



        $$A=int_0^1 f(x)dx=sum_n=1^infty f(x_n)(x_n-x_n-1)$$
        $$A = sum_k=1^n left(1-frac12^nright)left((1-frac12^n)-(1-frac12^n-1) right) =sum_k=1^n left(1-frac12^nright)frac12^n$$
        $$A = sum_k=1^nfrac12^n-sum_k=1^nfrac12^2n=1-frac13$$
        $$int_0^1 f(x)dx=frac23$$



        enter image description here







        share|cite|improve this answer















        share|cite|improve this answer



        share|cite|improve this answer








        edited Jul 16 at 10:25


























        answered Jul 16 at 9:40









        JJacquelin

        40.1k21649




        40.1k21649






















             

            draft saved


            draft discarded


























             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2853109%2fexpressing-a-step-function%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?