Re: List Manipulation: Conditionally changing y value when x value

• To: mathgroup at smc.vnet.net
• Subject: [mg109101] Re: List Manipulation: Conditionally changing y value when x value
• From: Armand Tamzarian <mike.honeychurch at gmail.com>
• Date: Mon, 12 Apr 2010 23:02:07 -0400 (EDT)
• References: <hpml5b\$9nk\$1@smc.vnet.net>

```On Apr 9, 2:31 am, "Charles Koehler" <cjk... at wi.rr.com> wrote:
> Hello,
>
> If possible I could use a little help on this.
>
> I have a list of  x and y data and based on the value of x I would like to
> manipulate the value y.
>
> I joined the data using:
>
>
> I assumed that by testing the x value using #[[1]], I could change the value
> of y using #[[2]] as shown below.  If no manipulation was required based on
> the value of x, I would keep that point unchanged, but I'm definitely
> missing something.
>
> filtered=If[a<#[[1]]&<b,#[[2]]&=0],{#[[1]],#[[2]]}&,pts]
>
> a and b are the range of x values
>
> Any insight would be much appreciated.
>
> Thanks,
>
> Chuck Koehler

Try using a rule replacement. e.g.

a=3;b=13;

Table[{RandomInteger[{0, 20}], RandomReal[{1, 4}]}, {20}] /. {x_,
y_} /; a < x < b :> {x, 0}

```

• Prev by Date: Re: Change of function in an ODE
• Next by Date: Re: beginner question about syntax
• Previous by thread: Re: List Manipulation: Conditionally changing y value when x value
• Next by thread: Re: if using Mathematica to solve an algebraic