Subscribe Bookmark RSS Feed

Creating a decay variable

sasuser1000

Community Member

Joined:

Jun 23, 2011

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

2 REPLIES
tomkari

Community Trekker

Joined:

Jun 23, 2011

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

ms

Super User

Joined:

Jun 23, 2011

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) )

  )

)