How should I make a selection from a list returned by Tuples?

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











up vote
3
down vote

favorite












Select[Tuples[1, 1/2, 4, 4], Total [#] == 15]


I want to select all tuples in the result returned by Tuples that have total of their elements equal to 15. The answer I got was only . Why?










share|improve this question









New contributor




Тахер Бен is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.























    up vote
    3
    down vote

    favorite












    Select[Tuples[1, 1/2, 4, 4], Total [#] == 15]


    I want to select all tuples in the result returned by Tuples that have total of their elements equal to 15. The answer I got was only . Why?










    share|improve this question









    New contributor




    Тахер Бен is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.





















      up vote
      3
      down vote

      favorite









      up vote
      3
      down vote

      favorite











      Select[Tuples[1, 1/2, 4, 4], Total [#] == 15]


      I want to select all tuples in the result returned by Tuples that have total of their elements equal to 15. The answer I got was only . Why?










      share|improve this question









      New contributor




      Тахер Бен is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      Select[Tuples[1, 1/2, 4, 4], Total [#] == 15]


      I want to select all tuples in the result returned by Tuples that have total of their elements equal to 15. The answer I got was only . Why?







      list-manipulation tuples






      share|improve this question









      New contributor




      Тахер Бен is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question









      New contributor




      Тахер Бен is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question








      edited 1 hour ago









      m_goldberg

      82k869190




      82k869190






      New contributor




      Тахер Бен is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 1 hour ago









      Тахер Бен

      183




      183




      New contributor




      Тахер Бен is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      Тахер Бен is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      Тахер Бен is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          4
          down vote



          accepted










          tuples = Tuples[1, 1/2, 4, 4];
          sel = Select[tuples, Total[#, 2] == 15 &];


          Alternatively,



          sel2 = Pick[tuples, Total[tuples, 3], 15];
          sel == sel2



          True




          Grid @ Partition[GeneralUtilities`ColorArrayForm /@ sel, 12]


          enter image description here



          Grid[Partition[MatrixPlot[#, Frame -> False, ImageSize -> 40] & /@ sel, 12]]


          enter image description here






          share|improve this answer





























            up vote
            0
            down vote













            There is an excelent answer with the illustration, but I would like to point out the specific mistakes:



            • Pure function in the second argmuent should end with &


            • Total[#] by default only sums on the first level, but you need more.





            share|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: "387"
              ;
              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: false,
              noModals: false,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );






              Тахер Бен is a new contributor. Be nice, and check out our Code of Conduct.









               

              draft saved


              draft discarded


















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f182162%2fhow-should-i-make-a-selection-from-a-list-returned-by-tuples%23new-answer', 'question_page');

              );

              Post as a guest






























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes








              up vote
              4
              down vote



              accepted










              tuples = Tuples[1, 1/2, 4, 4];
              sel = Select[tuples, Total[#, 2] == 15 &];


              Alternatively,



              sel2 = Pick[tuples, Total[tuples, 3], 15];
              sel == sel2



              True




              Grid @ Partition[GeneralUtilities`ColorArrayForm /@ sel, 12]


              enter image description here



              Grid[Partition[MatrixPlot[#, Frame -> False, ImageSize -> 40] & /@ sel, 12]]


              enter image description here






              share|improve this answer


























                up vote
                4
                down vote



                accepted










                tuples = Tuples[1, 1/2, 4, 4];
                sel = Select[tuples, Total[#, 2] == 15 &];


                Alternatively,



                sel2 = Pick[tuples, Total[tuples, 3], 15];
                sel == sel2



                True




                Grid @ Partition[GeneralUtilities`ColorArrayForm /@ sel, 12]


                enter image description here



                Grid[Partition[MatrixPlot[#, Frame -> False, ImageSize -> 40] & /@ sel, 12]]


                enter image description here






                share|improve this answer
























                  up vote
                  4
                  down vote



                  accepted







                  up vote
                  4
                  down vote



                  accepted






                  tuples = Tuples[1, 1/2, 4, 4];
                  sel = Select[tuples, Total[#, 2] == 15 &];


                  Alternatively,



                  sel2 = Pick[tuples, Total[tuples, 3], 15];
                  sel == sel2



                  True




                  Grid @ Partition[GeneralUtilities`ColorArrayForm /@ sel, 12]


                  enter image description here



                  Grid[Partition[MatrixPlot[#, Frame -> False, ImageSize -> 40] & /@ sel, 12]]


                  enter image description here






                  share|improve this answer














                  tuples = Tuples[1, 1/2, 4, 4];
                  sel = Select[tuples, Total[#, 2] == 15 &];


                  Alternatively,



                  sel2 = Pick[tuples, Total[tuples, 3], 15];
                  sel == sel2



                  True




                  Grid @ Partition[GeneralUtilities`ColorArrayForm /@ sel, 12]


                  enter image description here



                  Grid[Partition[MatrixPlot[#, Frame -> False, ImageSize -> 40] & /@ sel, 12]]


                  enter image description here







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited 58 mins ago

























                  answered 1 hour ago









                  kglr

                  161k8184384




                  161k8184384




















                      up vote
                      0
                      down vote













                      There is an excelent answer with the illustration, but I would like to point out the specific mistakes:



                      • Pure function in the second argmuent should end with &


                      • Total[#] by default only sums on the first level, but you need more.





                      share|improve this answer
























                        up vote
                        0
                        down vote













                        There is an excelent answer with the illustration, but I would like to point out the specific mistakes:



                        • Pure function in the second argmuent should end with &


                        • Total[#] by default only sums on the first level, but you need more.





                        share|improve this answer






















                          up vote
                          0
                          down vote










                          up vote
                          0
                          down vote









                          There is an excelent answer with the illustration, but I would like to point out the specific mistakes:



                          • Pure function in the second argmuent should end with &


                          • Total[#] by default only sums on the first level, but you need more.





                          share|improve this answer












                          There is an excelent answer with the illustration, but I would like to point out the specific mistakes:



                          • Pure function in the second argmuent should end with &


                          • Total[#] by default only sums on the first level, but you need more.






                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered 10 mins ago









                          Johu

                          3,1781033




                          3,1781033




















                              Тахер Бен is a new contributor. Be nice, and check out our Code of Conduct.









                               

                              draft saved


                              draft discarded


















                              Тахер Бен is a new contributor. Be nice, and check out our Code of Conduct.












                              Тахер Бен is a new contributor. Be nice, and check out our Code of Conduct.











                              Тахер Бен is a new contributor. Be nice, and check out our Code of Conduct.













                               


                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f182162%2fhow-should-i-make-a-selection-from-a-list-returned-by-tuples%23new-answer', 'question_page');

                              );

                              Post as a guest













































































                              Comments

                              Popular posts from this blog

                              List of Gilmore Girls characters

                              What does second last employer means? [closed]

                              One-line joke