Sample random vector meeting constraint












1














I'd like to sample a vector $mathbf{x}inmathbb{R}^k$ such that $frac{mathbf{x_i}}{|mathbf{x}|}geq c$ for all $i$ where $c in [0,frac{1}{sqrt{k}}]$. Is this possible? How can this be done?



So far, what I've been doing is randomly sampling a uniform distribution with a small interval and accepting the sample when the constraint is met.










share|cite|improve this question
























  • It depends on the value of $c$. If $c > 1$ then it won't be possible since $x_{i}/|x|leq 1$
    – pwerth
    Jan 4 at 18:56










  • How is the $mathbf{x}$ in the denominator related to the $mathbf{x}_i$?
    – Calvin Godfrey
    Jan 4 at 18:58










  • @pwerth I updated the question so that $cin[0,1]$. It should still work for my purposes.
    – Collin
    Jan 4 at 19:01






  • 3




    @CalvinGodfrey $x_i$ is meant to be the $i$-th dimension of $x$.
    – Collin
    Jan 4 at 19:01






  • 1




    Yes, $c$ is bound to be at most $1/sqrt{n}$
    – dafinguzman
    Jan 4 at 19:05
















1














I'd like to sample a vector $mathbf{x}inmathbb{R}^k$ such that $frac{mathbf{x_i}}{|mathbf{x}|}geq c$ for all $i$ where $c in [0,frac{1}{sqrt{k}}]$. Is this possible? How can this be done?



So far, what I've been doing is randomly sampling a uniform distribution with a small interval and accepting the sample when the constraint is met.










share|cite|improve this question
























  • It depends on the value of $c$. If $c > 1$ then it won't be possible since $x_{i}/|x|leq 1$
    – pwerth
    Jan 4 at 18:56










  • How is the $mathbf{x}$ in the denominator related to the $mathbf{x}_i$?
    – Calvin Godfrey
    Jan 4 at 18:58










  • @pwerth I updated the question so that $cin[0,1]$. It should still work for my purposes.
    – Collin
    Jan 4 at 19:01






  • 3




    @CalvinGodfrey $x_i$ is meant to be the $i$-th dimension of $x$.
    – Collin
    Jan 4 at 19:01






  • 1




    Yes, $c$ is bound to be at most $1/sqrt{n}$
    – dafinguzman
    Jan 4 at 19:05














1












1








1


1





I'd like to sample a vector $mathbf{x}inmathbb{R}^k$ such that $frac{mathbf{x_i}}{|mathbf{x}|}geq c$ for all $i$ where $c in [0,frac{1}{sqrt{k}}]$. Is this possible? How can this be done?



So far, what I've been doing is randomly sampling a uniform distribution with a small interval and accepting the sample when the constraint is met.










share|cite|improve this question















I'd like to sample a vector $mathbf{x}inmathbb{R}^k$ such that $frac{mathbf{x_i}}{|mathbf{x}|}geq c$ for all $i$ where $c in [0,frac{1}{sqrt{k}}]$. Is this possible? How can this be done?



So far, what I've been doing is randomly sampling a uniform distribution with a small interval and accepting the sample when the constraint is met.







vectors sampling






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited Jan 4 at 19:17







Collin

















asked Jan 4 at 18:53









CollinCollin

2201312




2201312












  • It depends on the value of $c$. If $c > 1$ then it won't be possible since $x_{i}/|x|leq 1$
    – pwerth
    Jan 4 at 18:56










  • How is the $mathbf{x}$ in the denominator related to the $mathbf{x}_i$?
    – Calvin Godfrey
    Jan 4 at 18:58










  • @pwerth I updated the question so that $cin[0,1]$. It should still work for my purposes.
    – Collin
    Jan 4 at 19:01






  • 3




    @CalvinGodfrey $x_i$ is meant to be the $i$-th dimension of $x$.
    – Collin
    Jan 4 at 19:01






  • 1




    Yes, $c$ is bound to be at most $1/sqrt{n}$
    – dafinguzman
    Jan 4 at 19:05


















  • It depends on the value of $c$. If $c > 1$ then it won't be possible since $x_{i}/|x|leq 1$
    – pwerth
    Jan 4 at 18:56










  • How is the $mathbf{x}$ in the denominator related to the $mathbf{x}_i$?
    – Calvin Godfrey
    Jan 4 at 18:58










  • @pwerth I updated the question so that $cin[0,1]$. It should still work for my purposes.
    – Collin
    Jan 4 at 19:01






  • 3




    @CalvinGodfrey $x_i$ is meant to be the $i$-th dimension of $x$.
    – Collin
    Jan 4 at 19:01






  • 1




    Yes, $c$ is bound to be at most $1/sqrt{n}$
    – dafinguzman
    Jan 4 at 19:05
















It depends on the value of $c$. If $c > 1$ then it won't be possible since $x_{i}/|x|leq 1$
– pwerth
Jan 4 at 18:56




It depends on the value of $c$. If $c > 1$ then it won't be possible since $x_{i}/|x|leq 1$
– pwerth
Jan 4 at 18:56












How is the $mathbf{x}$ in the denominator related to the $mathbf{x}_i$?
– Calvin Godfrey
Jan 4 at 18:58




How is the $mathbf{x}$ in the denominator related to the $mathbf{x}_i$?
– Calvin Godfrey
Jan 4 at 18:58












@pwerth I updated the question so that $cin[0,1]$. It should still work for my purposes.
– Collin
Jan 4 at 19:01




@pwerth I updated the question so that $cin[0,1]$. It should still work for my purposes.
– Collin
Jan 4 at 19:01




3




3




@CalvinGodfrey $x_i$ is meant to be the $i$-th dimension of $x$.
– Collin
Jan 4 at 19:01




@CalvinGodfrey $x_i$ is meant to be the $i$-th dimension of $x$.
– Collin
Jan 4 at 19:01




1




1




Yes, $c$ is bound to be at most $1/sqrt{n}$
– dafinguzman
Jan 4 at 19:05




Yes, $c$ is bound to be at most $1/sqrt{n}$
– dafinguzman
Jan 4 at 19:05










1 Answer
1






active

oldest

votes


















2














Let $z^i$ be the vector whose coordinates are all equal to $c$, except for the $i^{th}$ coordinate which is $sqrt{1-(k-1)c^2}$. Note that $|z^i|=1$, and each coordinate of $z^i$ is at least $c$. Therefore, $z^i$ is a vector which fulfills your constraints.



Furthermore, any convex combination of the vectors $z^i$ will fulfill your constraints. To see this, note that if $lambda_i$ is a list of positive numbers summing to one, and $z=sum lambda_i z^i$, then using the triangle inequality,
$$
z_j=sum_i lambda_iz^i_jge csum lambda_i |z^i|=csum |lambda_iz^i|ge cleft|sum_i lambda_i z^iright|=c|z|
$$



Therefore, one valid method is to randomly choose $k$ positive numbers $lambda_1,dots,lambda_k$ summing to $1$, and let ${bf x}=sum_i lambda_i z_i$. To do this, see simplex sampling.



To add a little more variety, you instead let ${bf x}=Rsum_i lambda_i z_i$, where $R$ is any positive random scalar. As long as the support of $R$ is $(0,infty)$, then the support of this sampling method is the set of all admissible vectors.






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',
    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
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3061969%2fsample-random-vector-meeting-constraint%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    2














    Let $z^i$ be the vector whose coordinates are all equal to $c$, except for the $i^{th}$ coordinate which is $sqrt{1-(k-1)c^2}$. Note that $|z^i|=1$, and each coordinate of $z^i$ is at least $c$. Therefore, $z^i$ is a vector which fulfills your constraints.



    Furthermore, any convex combination of the vectors $z^i$ will fulfill your constraints. To see this, note that if $lambda_i$ is a list of positive numbers summing to one, and $z=sum lambda_i z^i$, then using the triangle inequality,
    $$
    z_j=sum_i lambda_iz^i_jge csum lambda_i |z^i|=csum |lambda_iz^i|ge cleft|sum_i lambda_i z^iright|=c|z|
    $$



    Therefore, one valid method is to randomly choose $k$ positive numbers $lambda_1,dots,lambda_k$ summing to $1$, and let ${bf x}=sum_i lambda_i z_i$. To do this, see simplex sampling.



    To add a little more variety, you instead let ${bf x}=Rsum_i lambda_i z_i$, where $R$ is any positive random scalar. As long as the support of $R$ is $(0,infty)$, then the support of this sampling method is the set of all admissible vectors.






    share|cite|improve this answer




























      2














      Let $z^i$ be the vector whose coordinates are all equal to $c$, except for the $i^{th}$ coordinate which is $sqrt{1-(k-1)c^2}$. Note that $|z^i|=1$, and each coordinate of $z^i$ is at least $c$. Therefore, $z^i$ is a vector which fulfills your constraints.



      Furthermore, any convex combination of the vectors $z^i$ will fulfill your constraints. To see this, note that if $lambda_i$ is a list of positive numbers summing to one, and $z=sum lambda_i z^i$, then using the triangle inequality,
      $$
      z_j=sum_i lambda_iz^i_jge csum lambda_i |z^i|=csum |lambda_iz^i|ge cleft|sum_i lambda_i z^iright|=c|z|
      $$



      Therefore, one valid method is to randomly choose $k$ positive numbers $lambda_1,dots,lambda_k$ summing to $1$, and let ${bf x}=sum_i lambda_i z_i$. To do this, see simplex sampling.



      To add a little more variety, you instead let ${bf x}=Rsum_i lambda_i z_i$, where $R$ is any positive random scalar. As long as the support of $R$ is $(0,infty)$, then the support of this sampling method is the set of all admissible vectors.






      share|cite|improve this answer


























        2












        2








        2






        Let $z^i$ be the vector whose coordinates are all equal to $c$, except for the $i^{th}$ coordinate which is $sqrt{1-(k-1)c^2}$. Note that $|z^i|=1$, and each coordinate of $z^i$ is at least $c$. Therefore, $z^i$ is a vector which fulfills your constraints.



        Furthermore, any convex combination of the vectors $z^i$ will fulfill your constraints. To see this, note that if $lambda_i$ is a list of positive numbers summing to one, and $z=sum lambda_i z^i$, then using the triangle inequality,
        $$
        z_j=sum_i lambda_iz^i_jge csum lambda_i |z^i|=csum |lambda_iz^i|ge cleft|sum_i lambda_i z^iright|=c|z|
        $$



        Therefore, one valid method is to randomly choose $k$ positive numbers $lambda_1,dots,lambda_k$ summing to $1$, and let ${bf x}=sum_i lambda_i z_i$. To do this, see simplex sampling.



        To add a little more variety, you instead let ${bf x}=Rsum_i lambda_i z_i$, where $R$ is any positive random scalar. As long as the support of $R$ is $(0,infty)$, then the support of this sampling method is the set of all admissible vectors.






        share|cite|improve this answer














        Let $z^i$ be the vector whose coordinates are all equal to $c$, except for the $i^{th}$ coordinate which is $sqrt{1-(k-1)c^2}$. Note that $|z^i|=1$, and each coordinate of $z^i$ is at least $c$. Therefore, $z^i$ is a vector which fulfills your constraints.



        Furthermore, any convex combination of the vectors $z^i$ will fulfill your constraints. To see this, note that if $lambda_i$ is a list of positive numbers summing to one, and $z=sum lambda_i z^i$, then using the triangle inequality,
        $$
        z_j=sum_i lambda_iz^i_jge csum lambda_i |z^i|=csum |lambda_iz^i|ge cleft|sum_i lambda_i z^iright|=c|z|
        $$



        Therefore, one valid method is to randomly choose $k$ positive numbers $lambda_1,dots,lambda_k$ summing to $1$, and let ${bf x}=sum_i lambda_i z_i$. To do this, see simplex sampling.



        To add a little more variety, you instead let ${bf x}=Rsum_i lambda_i z_i$, where $R$ is any positive random scalar. As long as the support of $R$ is $(0,infty)$, then the support of this sampling method is the set of all admissible vectors.







        share|cite|improve this answer














        share|cite|improve this answer



        share|cite|improve this answer








        edited Jan 4 at 20:50

























        answered Jan 4 at 19:55









        Mike EarnestMike Earnest

        20.7k11950




        20.7k11950






























            draft saved

            draft discarded




















































            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.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3061969%2fsample-random-vector-meeting-constraint%23new-answer', 'question_page');
            }
            );

            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







            Popular posts from this blog

            An IMO inspired problem

            Management

            Has there ever been an instance of an active nuclear power plant within or near a war zone?