Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2011

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

Search the Archive

Applying function only if the output is positive

  • To: mathgroup at smc.vnet.net
  • Subject: [mg116290] Applying function only if the output is positive
  • From: ma07llg2 <lou2k4 at msn.com>
  • Date: Thu, 10 Feb 2011 05:20:49 -0500 (EST)

Hi,

I am trying to find a way which will only apply my function if the output is positive, this is what i have but when the numbers become negative i need them to not be included anymore.

update1[x_List] := 
 x + j.n[x] + Table[RandomReal[{-.5, .5}], {k, 1, Length[x]}]
w1[k_] := NestList[update1, gg, k]
w1[2]

{{0.261588, 0.512798, 0.709287, 0.914866, 0.779221, 0.00614278, 
  0.904256, 0.95166, 0.670016, 0.901556}, {0.427219, 0.656549, 
  0.825981, 1.38668, 0.667352, -0.0109928, 0.78814, 0.458776, 
  0.276835, 1.40125}, {-0.00600954, 0.831096, 1.58705, 2.69087, 
  1.12829, -0.0721115, 0.562469, 0.343643, 0.947323, 2.76569}}

Is this possible? any help would be really appreciated!
Thanks


  • Prev by Date: MathKernel -script in MacOSX
  • Next by Date: Re: Sorting nested lists with strings
  • Previous by thread: Re: MathKernel -script in MacOSX
  • Next by thread: Re: Applying function only if the output is positive