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: R: R: ReplacePart -> eliminate
Replies: 4   Last Post: Sep 19, 2013 1:14 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Brambilla Roberto Luigi (RSE)

Posts: 25
Registered: 2/21/12
R: R: ReplacePart -> eliminate
Posted: Sep 18, 2013 6:12 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply


Many thanks Bob!

I find great



Cases[y, {_?NumericQ ..}]



Since it works both with simple list and couple list.

What the meaning of .. operator?

Roberto







Da: Bob Hanlon [mailto:hanlonr357@gmail.com]
Inviato: mercoled=EC 18 settembre 2013 04:41
A: Brambilla Roberto Luigi (RSE)
Cc: MathGroup
Oggetto: Re: R: ReplacePart -> eliminate



y = Table[{n, 1/(3 - n)}, {n, 0, 5}] // Quiet


{{0, 1/3}, {1, 1/2}, {2, 1},
{3, ComplexInfinity},
{4, -1}, {5, -(1/2)}}


Note that your crtiteria in the Select does not produce a straight True or False


{NumberQ[#], NumberQ[#]} &[{2, 1}]


{False, False}


num = Select[y, And @@ NumericQ /@ # &]


{{0, 1/3}, {1, 1/2}, {2, 1},
{4, -1}, {5, -(1/2)}}


However, Cases is a better choice here


num ==
Cases[y, _?(And @@ NumericQ /@ # &)] ==
Cases[y, {_?NumericQ, _?NumericQ}] ==
Cases[y, {_?NumericQ ..}]


True





Bob Hanlon



On Tue, Sep 17, 2013 at 9:36 PM, Brambilla Roberto Luigi (RSE) <Roberto.Brambilla@rse-web.it> wrote:

Great!
Many thanks Alexei!
Now I have the following list of couples

y = Table[{n, 1/(3 - n)}, {n, 0, 5}]

{{0, 1/3}, {1, 1/2}, {2, 1}, {3, ComplexInfinity}, {4, -1}, {5, -(1/2)}}

The command

Select[y, {NumberQ[#], NumberQ[#]} &]

does not work. How can I modify your suggestion in order to eliminate the non-numerical couple {3,ComplexInfinity}
from the list (avoiding Transpose etc..)?

Rob.


-----Messaggio originale-----
Da: Alexei Boulbitch [mailto:Alexei.Boulbitch@iee.lu]
Inviato: marted=EC 17 settembre 2013 09:09
A: mathgroup@smc.vnet.net
Cc: Brambilla Roberto Luigi (RSE)
Oggetto: Re: ReplacePart -> eliminate


I'd like to eliminate the Indeterminate (or other non-numerical terms, as Infinite, etc...) items. Es.


x = {-1.25664, 0.628319, -0.628319, 1.25664, Indeterminate, -1.25664,
0.628319, -0.628319, 1.25664, Indeterminate};

or

x=Table[1/(3 - n), {n, 0, 5}])
{1/3, 1/2, 1, ComplexInfinity, -1,-1/2}

How can I do it with a simple command?
Many thanks, Roberto


Hi, Roberto,

Try this:

x = {-1.25664, 0.628319, -0.628319, 1.25664, Indeterminate, -1.25664,
0.628319, -0.628319, 1.25664, Indeterminate}; y = Table[1/(3 - n), {n, 0, 5}];

Select[x, NumberQ[#] &]
Select[y, NumberQ[#] &]

{-1.25664, 0.628319, -0.628319, 1.25664, -1.25664, 0.628319, \ -0.628319, 1.25664}

{1/3, 1/2, 1, -1, -(1/2)}

Have fun, Alexei

Alexei BOULBITCH, Dr., habil.
IEE S.A.
ZAE Weiergewan,
11, rue Edmond Reuter,
L-5326 Contern, LUXEMBOURG

Office phone : +352-2454-2566
Office fax: +352-2454-3566
mobile phone: +49 151 52 40 66 44

e-mail: alexei.boulbitch@iee.lu




RSE SpA ha adottato il Modello Organizzativo ai sensi del D.Lgs.231/2001, in forza del quale l'assunzione di obbligazioni da parte della Societ=E0 avvie
ne con firma di un procuratore, munito di idonei poteri.

RSE adopts a Compliance Programme under the Italian Law (D.Lgs.231/2001). According to this RSE Compliance Programme, any commitment of RSE is taken by the signature of one Representative granted by a proper Power of Attorney. Le informazioni contenute in questo messaggio di posta elettronica sono riservate e confidenziali e ne e' vietata la diffusione in qualsiasi modo o for
ma. Qualora Lei non fosse la persona destinataria del presente messaggio, Lainvitiamo a non diffonderlo e ad eliminarlo, dandone gentilmente comunicazione al mittente. The information included in this e-mail and any attachments are confidential and may also be privileged. If you are not the correct recipient, you are kindly requested to notify the sender immediately, to cancel
it and not to disclose the contents to any other person.





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.