Hi,
As usual, I have no idea where to find coherent documentation on subscripts in the Vensim manual. I am trying to use the SUM() function for the equation shown. Pretty straightforward in reality. In Vensim it is like pulling teeth.
Shown is what I have input into the variable:
Shown is the function editor for the ground function:
The SUBSCRIPTS error reads:
1. Unspecified subscript equation for h
2. Subscript 1 of variable ground function is a member of the h family when it should be a member of the pressure number family.
Any thoughts on this? Please don't bother responding "impossible to tell without looking at the model."
Death by Subscript

 Senior Member
 Posts: 53
 Joined: Tue Mar 14, 2023 2:05 am
 Vensim version: DSS
Re: Death by Subscript
Looking at the model may not be required, but I'm not sure an answer can be given from the material here. What you're showing seems syntactically valid, so the problem may be somewhere else.
What are the definitions of h and pressure number?
What is on the left side of the sum expression?
Is h the equivalent of n in the equation png, which presumably defines the ground function? In that case why does it not appear on the right side of the equation?
What are the definitions of h and pressure number?
What is on the left side of the sum expression?
Is h the equivalent of n in the equation png, which presumably defines the ground function? In that case why does it not appear on the right side of the equation?
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/

 Senior Member
 Posts: 53
 Joined: Tue Mar 14, 2023 2:05 am
 Vensim version: DSS
Re: Death by Subscript
I need to counter this by asking what the SUM() function is. It does not appear that it is a large operator, upper case sigma. If it was, it would not need subscripts at all. h does nothing. It is a formality in an attempt to get SUM() to work like a sum. In the manual and in the program I cannot simply have SUM(ground function), I need to have SUM(ground function[pointless exclamation!]).
So, what does SUM() actually do as a mathematical use case?
So, what does SUM() actually do as a mathematical use case?

 Super Administrator
 Posts: 4658
 Joined: Wed Mar 05, 2003 3:10 am
Re: Death by Subscript
The SUM function is used over a subscript range, and you can think of subscripts as an array.
Looking at the equation you are trying to implement, there is a sum over "n". So you would define the subscript range as
n : (n1n2). But I cannot see "n" in the equation you've entered in Vensim, so I'm not sure what "n" actually is.
Looking at the equation you are trying to implement, there is a sum over "n". So you would define the subscript range as
n : (n1n2). But I cannot see "n" in the equation you've entered in Vensim, so I'm not sure what "n" actually is.
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine27509559
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine27509559
Re: Death by Subscript
do the errors disappear if you suppress the sum function in the model, and is the ground function calculated? In that case the ground function does not look like depending on the subscript n and you should replace the sum function by ground function * elmcount'n). the answer to your question is in the model and you should show it!
Re: Death by Subscript
SUM is definitely the summation operator Sigma. The exclamation point is not useless; it is necessary in cases where you'd like to sum over a subset of the dimensions belonging to the right side.
I would write the equation in your image with something like the following:
n : n1, n2
s : <something>
amp : <something>
number[n] = INITIAL( n )
The subscript values for n will be an integer sequence starting with 1; you could also write something like,
number[n] = 1,2
to initialize to arbitrary constant values.
F[s,amp] = SUM( EXP(z*SQRT(number[n!]*pi/stuff)*T[s,amp,n!] )
I would write the equation in your image with something like the following:
n : n1, n2
s : <something>
amp : <something>
number[n] = INITIAL( n )
The subscript values for n will be an integer sequence starting with 1; you could also write something like,
number[n] = 1,2
to initialize to arbitrary constant values.
F[s,amp] = SUM( EXP(z*SQRT(number[n!]*pi/stuff)*T[s,amp,n!] )
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/

 Senior Member
 Posts: 53
 Joined: Tue Mar 14, 2023 2:05 am
 Vensim version: DSS
Re: Death by Subscript
Hi Tom,
Your last explanation made sense. I am not showing the model because I have already had my previous work copied and claimed by many other people.
In reflecting on this, I do not need the SUM() at all, since I can simply write in constants for this particular equation, which makes it all relatively pointless to pursue variations on n. N is simply the number of harmonics between 1 and 2 with all other values apparently linked to tabular field data. These values for T[s,amp,n] cannot be known without prior field measurements. There is also some phase lag in here, which is not reflected in the original post.
I could simply plug in a bunch of parameters to this equation and produce a curve. Relatively uninteresting in the end. I am still not confident with these subscripts, however. I really do think the documentation needs a full rewrite on this.
Your last explanation made sense. I am not showing the model because I have already had my previous work copied and claimed by many other people.
In reflecting on this, I do not need the SUM() at all, since I can simply write in constants for this particular equation, which makes it all relatively pointless to pursue variations on n. N is simply the number of harmonics between 1 and 2 with all other values apparently linked to tabular field data. These values for T[s,amp,n] cannot be known without prior field measurements. There is also some phase lag in here, which is not reflected in the original post.
I could simply plug in a bunch of parameters to this equation and produce a curve. Relatively uninteresting in the end. I am still not confident with these subscripts, however. I really do think the documentation needs a full rewrite on this.