tracing the values of variables inside a find zero loop

Use this forum to post Vensim related questions.
Post Reply
LAUJJL
Senior Member
Posts: 1427
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

tracing the values of variables inside a find zero loop

Post by LAUJJL »

Hi

Is there a built in method to trace the values of the variables that are on a find zero loop, as the convergence process is working?
I have one solution a bit cumbersome: building a subscript with dimension equal to the maximum of iteration, put a
variable on the loop that calculates the number of iteration and stock each value of each variable from each iteration into a subscripted variable with the subscript before mentionned.
Regards.
JJ
bob@vensim.com
Senior Member
Posts: 1107
Joined: Wed Mar 12, 2003 2:46 pm

Post by bob@vensim.com »

There is no mechanism to trace the convergence of FIND ZERO or SIMULTANEOUS functions. I am actually a little bit surprised that your method will work. I would have suggested simply starting with a very large tolerance, then making the tolerance somewhat smaller to see what happens.

You can create an external function either to explicitly manage the loop or to be called as part of the loop and look at values either by logging them or in a debugger.
LAUJJL
Senior Member
Posts: 1427
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

tracing find zero

Post by LAUJJL »

Hi Bob

You are right: It seems much more trickier than I thought first. The problem is that one has no control on the loop from the start until the end. And replacing values by vectors does not work either. One solution would be to use vectors and to know the algorithm used by Vensim to find the zero of a function, if it is simple enough to reproduce in Vensim.
I replace sometimes values by vectors to allow for a loop to work, and avoid instantaneous errors. I thought it would work in this case. I will try your method.
Another solution would be to calculate different values corresponding to different tolerances and store them in an array. It looks like the method you proposed but is automatic.
Regards.
JJ

[Edited on 16-5-2008 by LAUJJL]
LAUJJL
Senior Member
Posts: 1427
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

tracing find zero

Post by LAUJJL »

Hi

I have tired the model joined to trace the values inside a find zero loop, but I did not find a way to intialize the loop.
It is not possible to use two functions when using a find zero
with a subscriptes variable.
Regards.
JJ
Attachments
find zero tracing_2.mdl
(2.52 KiB) Downloaded 262 times
Post Reply