Page 1 of 1

Subscripts and graphs.

Posted: Fri Feb 05, 2010 9:08 am
by nikvyas
Good morning all.

I have question about subscripts and the resulting ouput graphs.

The first question is to do with the number of subscripts on one variable. It's a little difficult to explain, but I'll try anyway! I have a variable (called example1) that uses two subscript ranges (aircraft,probabilities). Although the algorithm within example1 uses the full subscript ranges (of both aircraft and probabilities), the output (into a variable called example 2) requires the full range of "aircraft", but only the first element of "probabilities". i.e., example2[aircraft,p1]=example1[aircraft,p1]+1

All the subsequent variables also use the full range of "aircraft" but only the first element of "probabilities" (p1). So the question is, is there any way of reducing the number of subscripts in all of these subsequent variables to just one - i.e. to just "aircraft" - it seems a waste (especially when I come to use the"Table" tool) to use two subscript if only one element of "probabilities" is subesequently used.

The second question is wrt the graph function. I have a variable with three subscripts (one of these is "probabilities", but only 1 element is used, as described above). However, when I plot the graph, all the curves are the same colour - i.e., it doesn't distinguish between the different subscripts which makes the graph next to useless. I suspect this is because there are three subscripts, which is one reason why I asked if there was any way to reduce it to two.

Hope this is clear (probably not).

Thanks

Nik

Posted: Fri Feb 05, 2010 9:50 am
by nikvyas
Actually, of the three subscripts referred to above, the full range is used on one and only the first subscript of each of the other two is used - i.e., - [FEAR, a1, p1]

So if it is possible to reduce it to just the one subscript (FEAR) it would be beneficial.

Posted: Fri Feb 05, 2010 11:36 am
by bob@vensim.com
Use

example2[aircraft]=example1[aircraft,p1]+1

You can mix up variables with different subscripts in equations without difficulty. The main rules are that a subscript on the right must be on the left, and that the same variable is always used with the same number of subscripts.

On the graph, if the variables have the same value they form a single line (so you only see 1 color). This is just because all are on top of each other - you can set the graph to show thick lines to overcome this.

Posted: Fri Feb 05, 2010 11:52 am
by nikvyas
Thanks Bob.

Wow, was it really that simple? I had always assumed that both the left and the right had to have the same number of subscripts.

Thanks again.

Posted: Mon Feb 15, 2010 10:10 pm
by tomfid
As a rule, the left and right side have to have the same number of subscript ranges. They key here is that in

example2[aircraft]=example1[aircraft,p1]+1

p1 is a single _element_ of probabilities, not a _range_. Therefore no corresponding range needs to exist on the left side.

The left and right side ranges might not be the same if you've used subscript mapping.

Tom