Dynamic variable

Clear all

# Dynamic variable

3 Posts
3 Users
0 Likes
211 Views
Posts: 1
Customer
Topic starter
New Member
Joined: 4 months ago

Dear Analytical users,

I am newbe.

If I define inv_t as:

Dynamic[i_t](inv_0,Self[i_t-1]-dem_t[i_t]+lambda[i_t])

And i_t as:

1 .. 365

I will obtein in inv_t as

first value

inv_0

inv_0

second value

inv_0 - dem_t + lambda

or second value is

inv_0 - dem_t + lambda

Sebastián.

2 Replies
Posts: 27
Eminent Member
Joined: 12 years ago

The second value will be

inv_0 - dem_t + lambda

Let's take some example values:

Inv_0 := 100000
Dem_t := 10 * I_t
Lambda := 100 * I_t

The result sequence will be:

100000
100000 + 200 - 20 = 100180
100180 + 300 - 30 = 100450
100450 + 400 - 40 = 100810
...

By the way, if you prefer writing dem_t[I_t] then that is fine, but the [I_t] part is not doing anything since variable names in a Dynamic automatically use the current time slice.  So it is entirely equivalent to write

Dynamic[i_t](inv_0, Self[i_t-1] - dem_t + lambda)

My own preference is to not include the extra subscript notation.

Posts: 3
Customer
Active Member
Joined: 2 years ago

In a Dynamic, the notation X[I_t - k] is by position, not by value. So this notation is an abbreviated for X[@I_t = @I_t - k].  In general, this is not the same as X[ I_t = I_t - k ] nor X[ @I_t = I_t - k ].

Since positions are numbered starting at 1, positional and associative subscripts are the same in your example where you have

Index I_t := 1..365

Index I_t := 0..364