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: Re: Q:Nicer than: Function[x,MapAt[Im,x,2]]/@data
Replies: 0  

Advanced Search

Back to Topic List Back to Topic List  
Martin Rommel

Posts: 11
Registered: 12/7/04
Re: Q:Nicer than: Function[x,MapAt[Im,x,2]]/@data
Posted: Dec 6, 1996 11:44 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply


On Fri, 06 Dec 1996 17:40:56 +0100 Clemens Frey
<Clemens.Frey@uni-bayreuth.de> wrote:
>
>
> Hi,
>
> pattern matching can do a good job here.
> Just having defined
>
> data = {{1.,I},{2,1+2*I}};
>
> try the following:
>
> data /. {_Real,y_} -> Im[y] /. {_Integer,y_} -> Im[y]
>
> to get a list of imaginary parts of the second components
> of the pairs in the list.
> If you are sure that all first components are really Real
> (other than in the example above!), then you can drop the
> "/. {_Integer,y_} -> Im[y]" - thing.
> I used _Real instead of _ alone to avoid problems with
> lists of two pairs, on which {_,y_} would also match :-{.
>
> Hope this is what you needed
>
> Clemens
> (-: Clemens.Frey@uni-bayreuth.de :-)


Danke!
Ich hatte schon vermutet dass es eine Unzahl von
Moeglichkeiten gibt und haqbe eine Rieh von Vorschlaegen
erhalten. Deiner ist neu!

Mma ist schon beeindruckend vielfaelitg, ich wuerde gern
mehr damit arbeiten.

Tschuess, (oder ist das zu norddeutsch?)

Martin.










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.