The Math Forum

Search All of the Math Forum:

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

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

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

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
<> 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
> (-: :-)

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?)


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

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.