Choose Language Hide Translation Bar
Highlighted
sasuser1000
Community Member

Creating a decay variable

I am looking to create a variable that will have a different value by time based on another, in this case to create Y.

For example:

time   x     y

1       10    10

2        0      5

3        0      2.5

0 Kudos
2 REPLIES 2
tomkari
Community Trekker

Re: Creating a decay variable

You'll need to post a little more logic than that. As an example, from your post I might infer this:

For every record:

Copy X to Y

Output a result record

Until Y < .001

  X = 0

  Y = Y / 2

  Output a result record

End

0 Kudos
ms
Super User ms
Super User

Re: Creating a decay variable

You could use a column formula Y=10/(2^(Time-1)).

A table based on your example:

New Table( "untitled",

  Add Rows( 4 ),

  New Column( "Time",

  Numeric,

  Set Values( [1, 2, 3,] )

  ),

  New Column( "X",

  Numeric,

  Set Values( [10, 0, 0] )

  ),

  New Column( "Y",

  Numeric,

  Formula( :X[1] / 2 ^ (:Time - 1) )

  )

)

0 Kudos