MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Modifying List Elements.

  • To: mathgroup at smc.vnet.net
  • Subject: [mg98960] Re: Modifying List Elements.
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Wed, 22 Apr 2009 06:32:07 -0400 (EDT)
  • Organization: Uni Leipzig
  • References: <gsmn1l$d3l$1@smc.vnet.net>
  • Reply-to: kuska at informatik.uni-leipzig.de

Hi,

data = {{0, 1}, {1, 2}};

with:

{0, 0.5 } + # & /@ data

or

data /. {a_?NumericQ, b_?NumericQ} :> {a, b + 0.5}

or

ReplacePart[#, 2 -> #[[2]] + 0.5] & /@ data

Regards
   Jens


nick.maj at mssm.edu wrote:
> how can i add a value to an element in lists?
> 
> data:
> {{0,1},{1,2}}
> 
> needed output:
> {{0,1.5},{1,2.5}}
> 
> thanks in advance, nick.
> 


  • Prev by Date: Re: Looking for more Mathematica online user groups/forums
  • Next by Date: Re: converting binary data
  • Previous by thread: Modifying List Elements.
  • Next by thread: Re: Modifying List Elements.