Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

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

Search the Archive

Re: Replacing Values Close to One

  • To: mathgroup at smc.vnet.net
  • Subject: [mg105295] Re: Replacing Values Close to One
  • From: dh <dh at metrohm.com>
  • Date: Thu, 26 Nov 2009 06:15:04 -0500 (EST)
  • References: <hekug7$921$1@smc.vnet.net>


Gregory Lypny wrote:

> Hello everyone,

> 

> Is there a replacement rule that I can apply to

> 

> 	{-8, .7, 0, 1.003}  /.  [what goes here?] -> 1

> 

> to replace values that are close to 1, like 1.003, by 1?

> 

> Regards,

> 

> 	Gregory

> 

> 

> 

Hi Gregory,

use a condition on a pattern:



{-8, .7, 0, 1.003} /. x_ /; Abs[x - 1] < 0.1 -> 1



Daniel




  • Prev by Date: Re: Re: Is it possible to make NIntegrate
  • Next by Date: Re: Replacing Values Close to One
  • Previous by thread: Replacing Values Close to One
  • Next by thread: Re: Replacing Values Close to One