Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #15749

Applying function only if the output is positive

From ma07llg2 <lou2k4@msn.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Applying function only if the output is positive
Date 2011-02-10 10:20 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <ij0e59$9a8$1@smc.vnet.net> (permalink)

Show all headers | View raw


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

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Applying function only if the output is positive ma07llg2 <lou2k4@msn.com> - 2011-02-10 10:20 +0000

csiph-web