Death by Subscript

Use this forum to post Vensim related questions.
Post Reply
geo_curious
Member
Posts: 46
Joined: Tue Mar 14, 2023 2:05 am
Vensim version: DSS

Death by Subscript

Post by geo_curious »

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.
picture.png
picture.png (2.25 KiB) Viewed 132 times
Shown is what I have input into the variable:
picture2.png
picture2.png (7.31 KiB) Viewed 132 times
Shown is the function editor for the ground function:
picture3.png
picture3.png (503.32 KiB) Viewed 132 times
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."
tomfid
Administrator
Posts: 3811
Joined: Wed May 24, 2006 4:54 am

Re: Death by Subscript

Post by tomfid »

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?
geo_curious
Member
Posts: 46
Joined: Tue Mar 14, 2023 2:05 am
Vensim version: DSS

Re: Death by Subscript

Post by geo_curious »

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?
Administrator
Super Administrator
Posts: 4592
Joined: Wed Mar 05, 2003 3:10 am

Re: Death by Subscript

Post by Administrator »

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 : (n1-n2). 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/magazine-27509559
LAUJJL
Senior Member
Posts: 1427
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

Re: Death by Subscript

Post by LAUJJL »

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!
tomfid
Administrator
Posts: 3811
Joined: Wed May 24, 2006 4:54 am

Re: Death by Subscript

Post by tomfid »

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!] )
Post Reply