List of lists elementwise greater/smaller thanElement-wise test on List elementsCombining two listsFast method for combining two listsConditional combining of nested listsHow to use select and map togetherSelect sub-lists of common length from a listCombination of lists elementwiseProducing a list of all the pairs can be made by from two lists of equal lengthCreating lists within lists by sortingComparing elements in a list of listsMultiply two lists

Can we use the verb "says" for advertisement?

You've spoiled/damaged the card

The ring of global sections of a regular scheme

Incremental Ranges!

Working in the USA for living expenses only; allowed on VWP?

Building a road to escape Earth's gravity by making a pyramid on Antartica

What happens to foam insulation board after you pour concrete slab?

I wrote a scene that the majority of my readers loved. How do I get back to that place while writing my new book?

When writing an error prompt, should we end the sentence with a exclamation mark or a dot?

Is there any word or phrase for negative bearing?

what is triplication on fpga?

Word for a small burst of laughter that can't be held back

Side by side histograms

Humans meet a distant alien species. How do they standardize? - Units of Measure

Is it a problem that pull requests are approved without any comments

Is it OK to bring delicacies from hometown as tokens of gratitude for an out-of-town interview?

Why don't B747s start takeoffs with full throttle?

Why is the relationship between frequency and pitch exponential?

Does any lore text explain why the planes of Acheron, Gehenna, and Carceri are the alignment they are?

It possible to have subscript and super script that does not shrink the font size?

Is it possible for people to live in the eye of a permanent hypercane?

How to split a string in two substrings of same length using bash?

Riley's, assemble!

Can a magnetic field of an object be stronger than its gravity?



List of lists elementwise greater/smaller than


Element-wise test on List elementsCombining two listsFast method for combining two listsConditional combining of nested listsHow to use select and map togetherSelect sub-lists of common length from a listCombination of lists elementwiseProducing a list of all the pairs can be made by from two lists of equal lengthCreating lists within lists by sortingComparing elements in a list of listsMultiply two lists













4












$begingroup$


I have two lists



a = 3,1,2,5,1,3,4,1,1
b = 4,0,3,4,2,2,5,0,2


And would like to compare each element within



Ifa>b,1,0


expecting the result



0,1,0,1,0,1,0,1,0


but it doesn't work, how can I get this type of comparison?










share|improve this question











$endgroup$







  • 1




    $begingroup$
    Strongly related
    $endgroup$
    – Leonid Shifrin
    May 18 at 18:57










  • $begingroup$
    you could use 1-UnitStep[b-a]?
    $endgroup$
    – kglr
    May 18 at 19:02










  • $begingroup$
    Of course, fixed.
    $endgroup$
    – Three Diag
    May 18 at 19:02










  • $begingroup$
    @kglr yep, that achieves the result, thanks
    $endgroup$
    – Three Diag
    May 18 at 19:05















4












$begingroup$


I have two lists



a = 3,1,2,5,1,3,4,1,1
b = 4,0,3,4,2,2,5,0,2


And would like to compare each element within



Ifa>b,1,0


expecting the result



0,1,0,1,0,1,0,1,0


but it doesn't work, how can I get this type of comparison?










share|improve this question











$endgroup$







  • 1




    $begingroup$
    Strongly related
    $endgroup$
    – Leonid Shifrin
    May 18 at 18:57










  • $begingroup$
    you could use 1-UnitStep[b-a]?
    $endgroup$
    – kglr
    May 18 at 19:02










  • $begingroup$
    Of course, fixed.
    $endgroup$
    – Three Diag
    May 18 at 19:02










  • $begingroup$
    @kglr yep, that achieves the result, thanks
    $endgroup$
    – Three Diag
    May 18 at 19:05













4












4








4


1



$begingroup$


I have two lists



a = 3,1,2,5,1,3,4,1,1
b = 4,0,3,4,2,2,5,0,2


And would like to compare each element within



Ifa>b,1,0


expecting the result



0,1,0,1,0,1,0,1,0


but it doesn't work, how can I get this type of comparison?










share|improve this question











$endgroup$




I have two lists



a = 3,1,2,5,1,3,4,1,1
b = 4,0,3,4,2,2,5,0,2


And would like to compare each element within



Ifa>b,1,0


expecting the result



0,1,0,1,0,1,0,1,0


but it doesn't work, how can I get this type of comparison?







list-manipulation map boolean-computation






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited May 18 at 19:02







Three Diag

















asked May 18 at 18:54









Three DiagThree Diag

346111




346111







  • 1




    $begingroup$
    Strongly related
    $endgroup$
    – Leonid Shifrin
    May 18 at 18:57










  • $begingroup$
    you could use 1-UnitStep[b-a]?
    $endgroup$
    – kglr
    May 18 at 19:02










  • $begingroup$
    Of course, fixed.
    $endgroup$
    – Three Diag
    May 18 at 19:02










  • $begingroup$
    @kglr yep, that achieves the result, thanks
    $endgroup$
    – Three Diag
    May 18 at 19:05












  • 1




    $begingroup$
    Strongly related
    $endgroup$
    – Leonid Shifrin
    May 18 at 18:57










  • $begingroup$
    you could use 1-UnitStep[b-a]?
    $endgroup$
    – kglr
    May 18 at 19:02










  • $begingroup$
    Of course, fixed.
    $endgroup$
    – Three Diag
    May 18 at 19:02










  • $begingroup$
    @kglr yep, that achieves the result, thanks
    $endgroup$
    – Three Diag
    May 18 at 19:05







1




1




$begingroup$
Strongly related
$endgroup$
– Leonid Shifrin
May 18 at 18:57




$begingroup$
Strongly related
$endgroup$
– Leonid Shifrin
May 18 at 18:57












$begingroup$
you could use 1-UnitStep[b-a]?
$endgroup$
– kglr
May 18 at 19:02




$begingroup$
you could use 1-UnitStep[b-a]?
$endgroup$
– kglr
May 18 at 19:02












$begingroup$
Of course, fixed.
$endgroup$
– Three Diag
May 18 at 19:02




$begingroup$
Of course, fixed.
$endgroup$
– Three Diag
May 18 at 19:02












$begingroup$
@kglr yep, that achieves the result, thanks
$endgroup$
– Three Diag
May 18 at 19:05




$begingroup$
@kglr yep, that achieves the result, thanks
$endgroup$
– Three Diag
May 18 at 19:05










2 Answers
2






active

oldest

votes


















7












$begingroup$

Boole@Positive[a-b]



0, 1, 0, 1, 0, 1, 0, 1, 0




1-UnitStep[b-a]



0, 1, 0, 1, 0, 1, 0, 1, 0







share|improve this answer









$endgroup$




















    3












    $begingroup$

    kglr took the fast, vectorized operations. Here are some less optimal ones that you can have a look at for fun or for learning:



    Boole@MapThread[Greater, a, b, 2]



    0, 1, 0, 1, 0, 1, 0, 1, 0




    Boole@Apply[Greater, Transpose[a, b, 3, 2, 1], 2]



    0, 1, 0, 1, 0, 1, 0, 1, 0







    share|improve this answer









    $endgroup$













      Your Answer








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



      );













      draft saved

      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f198622%2flist-of-lists-elementwise-greater-smaller-than%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      7












      $begingroup$

      Boole@Positive[a-b]



      0, 1, 0, 1, 0, 1, 0, 1, 0




      1-UnitStep[b-a]



      0, 1, 0, 1, 0, 1, 0, 1, 0







      share|improve this answer









      $endgroup$

















        7












        $begingroup$

        Boole@Positive[a-b]



        0, 1, 0, 1, 0, 1, 0, 1, 0




        1-UnitStep[b-a]



        0, 1, 0, 1, 0, 1, 0, 1, 0







        share|improve this answer









        $endgroup$















          7












          7








          7





          $begingroup$

          Boole@Positive[a-b]



          0, 1, 0, 1, 0, 1, 0, 1, 0




          1-UnitStep[b-a]



          0, 1, 0, 1, 0, 1, 0, 1, 0







          share|improve this answer









          $endgroup$



          Boole@Positive[a-b]



          0, 1, 0, 1, 0, 1, 0, 1, 0




          1-UnitStep[b-a]



          0, 1, 0, 1, 0, 1, 0, 1, 0








          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered May 18 at 19:06









          kglrkglr

          195k10216439




          195k10216439





















              3












              $begingroup$

              kglr took the fast, vectorized operations. Here are some less optimal ones that you can have a look at for fun or for learning:



              Boole@MapThread[Greater, a, b, 2]



              0, 1, 0, 1, 0, 1, 0, 1, 0




              Boole@Apply[Greater, Transpose[a, b, 3, 2, 1], 2]



              0, 1, 0, 1, 0, 1, 0, 1, 0







              share|improve this answer









              $endgroup$

















                3












                $begingroup$

                kglr took the fast, vectorized operations. Here are some less optimal ones that you can have a look at for fun or for learning:



                Boole@MapThread[Greater, a, b, 2]



                0, 1, 0, 1, 0, 1, 0, 1, 0




                Boole@Apply[Greater, Transpose[a, b, 3, 2, 1], 2]



                0, 1, 0, 1, 0, 1, 0, 1, 0







                share|improve this answer









                $endgroup$















                  3












                  3








                  3





                  $begingroup$

                  kglr took the fast, vectorized operations. Here are some less optimal ones that you can have a look at for fun or for learning:



                  Boole@MapThread[Greater, a, b, 2]



                  0, 1, 0, 1, 0, 1, 0, 1, 0




                  Boole@Apply[Greater, Transpose[a, b, 3, 2, 1], 2]



                  0, 1, 0, 1, 0, 1, 0, 1, 0







                  share|improve this answer









                  $endgroup$



                  kglr took the fast, vectorized operations. Here are some less optimal ones that you can have a look at for fun or for learning:



                  Boole@MapThread[Greater, a, b, 2]



                  0, 1, 0, 1, 0, 1, 0, 1, 0




                  Boole@Apply[Greater, Transpose[a, b, 3, 2, 1], 2]



                  0, 1, 0, 1, 0, 1, 0, 1, 0








                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered May 18 at 19:13









                  C. E.C. E.

                  52.3k3102209




                  52.3k3102209



























                      draft saved

                      draft discarded
















































                      Thanks for contributing an answer to Mathematica 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.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f198622%2flist-of-lists-elementwise-greater-smaller-than%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

                      How to write a 12-bar blues melodyI-IV-V blues progressionHow to play the bridges in a standard blues progressionHow does Gdim7 fit in C# minor?question on a certain chord progressionMusicology of Melody12 bar blues, spread rhythm: alternative to 6th chord to avoid finger stretchChord progressions/ Root key/ MelodiesHow to put chords (POP-EDM) under a given lead vocal melody (starting from a good knowledge in music theory)Are there “rules” for improvising with the minor pentatonic scale over 12-bar shuffle?Confusion about blues scale and chords

                      What if the end-user didn't have the required library?What is setup.py?What is a clean, pythonic way to have multiple constructors in Python?What does Ruby have that Python doesn't, and vice versa?What is the reason for having '//' in Python?How do I create a namespace package in Python?How to package shared objects that python modules depend on?setuptools vs. distutils: why is distutils still a thing?Navigation in Windows 10 vs code not going to virtualenv library when the same library is installed at user levelPython create package for local usePackaging a project that uses multiple python versionsWhy is permission denied on pip install except for when “--user” is included at end of command?

                      Esgonzo ibérico Índice Descrición Distribución Hábitat Ameazas Notas Véxase tamén "Acerca dos nomes dos anfibios e réptiles galegos""Chalcides bedriagai"Chalcides bedriagai en Carrascal, L. M. Salvador, A. (Eds). Enciclopedia virtual de los vertebrados españoles. Museo Nacional de Ciencias Naturales, Madrid. España.Fotos