Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.math.mathematica

Topic: How to use Pick[]; Is this a bug?
Replies: 2   Last Post: Aug 22, 2012 3:54 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Peter Pein

Posts: 1,147
Registered: 5/4/05
Re: How to use Pick[]; Is this a bug?
Posted: Aug 15, 2012 3:34 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Am 14.08.2012 10:22, schrieb benp84@gmail.com:
> In[1]:= Pick[{1, 2, 3, 4, 5}, {9, 0, 7, 0, 6}, Except[0]]
> Out[1]:= {1, 2, 3, 4, 5}
>
> Shouldn't this return {1, 3, 5}, since these are the corresponding elements that match Except[0]?
>


Hi,

the whole list {9, 0, 7, 0, 6} is unequal to the Integer 0.

What you want is:

Pick[{1, 2, 3, 4, 5}, {9, 0, 7, 0, 6}, Except[0, _Integer]]

Cheers,
Peter




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.