find zero

Use this forum to post Vensim related questions.
Post Reply
addor
Senior Member
Posts: 50
Joined: Mon Oct 27, 2003 9:45 am

find zero

Post by addor »

Once I asked about optimization simulation (Bellman or likewise) and you suggested to use the FIND ZERO function. After a break I'm studying this function now. I have no problem to solve equations in x saved in the variable z that is input to the variable x=FIND ZERO(...z...) which is again input to z. The function is estonishing efficient and fast.

But I have problems to implement the function into a greater and especially dynamic context. Let's assume we have a flow that is linear in time and leads to a stock that is a parabel with a extremum. I would like to know the time value of this extremum. So I have to find zero of the flow (see attachment)

I'm afraid that I confuse time development and equation approximation. But there are only a few examples. The both in the manual have too less compexity and the Fiddaman's one in the NEPHRON5 is on the other hand in a too large context to be understandable.

Can someone give me an example of how to find zero of an arbitrary flow?

Thanks,
Peter Addor
Peter Addor
LAUJJL
Senior Member
Posts: 1427
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

find zero

Post by LAUJJL »

Hi Addor

I cannot see any attachment in your post.
It would be a good idea to join a simple model to illustrate your difficulties!
Regards.
JJ
addor
Senior Member
Posts: 50
Joined: Mon Oct 27, 2003 9:45 am

my model

Post by addor »

Yes of course JJ, I tryied to attach a model. Here I retry it and hope it works now.

Two diopolists are trying to maximize their benefit. The price depends of the respective market shares and the benefit is "market share * price - market share * production costs".

If the benefit is smaler than the max benefit they will add a delta to their market share. So the max benefit would be calculated as a FIND ZERO of the flow "growth of the benefit". But I didn't make it...

Regards,
Peter
Attachments
Diopol.mdl
(5.26 KiB) Downloaded 390 times
Peter Addor
LAUJJL
Senior Member
Posts: 1427
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

Find zero

Post by LAUJJL »

Hi Peter

Can you put the units in your model.
It may help you more than me.
If you have still problems, I will try to help you.
Regards.
JJ
addor
Senior Member
Posts: 50
Joined: Mon Oct 27, 2003 9:45 am

Post by addor »

Ooops, JJ, the variables are dimensionless. The market shares are fractions of the total market that is assumed as 1. The price is a normed price relative to the threshold if there is no supply. What would you pay for a mobile phone if there is no supply at all? 3000 Euro or 5000 Dollars? In my model this is 1. If the total supply is 1 then the price is equal or less than the production costs.
Indeed I cannot assign a dimension or unit with a clear conscience...
Peter Addor
LAUJJL
Senior Member
Posts: 1427
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

Find ZERO

Post by LAUJJL »

Hi Peter

The variables you have are not dimensionless because if you put dmnl as dimension, the model will not stand the unit checks.
Dimensionless and no dimension at all is not the same thing.
I think that one of the force of SD among a lot of drawbacks is the capability to dimension the values to be able to check the equations against the preassigned dimensions.
It is too bad not to use this feature that is easy to implement has no drawback and can only bring advantages and understanding.
If I have some time I will put dimensions on your model.
Whether you use Euros or Dollars has no importance, you have to make some choices and it is the respective coherence of your choices that is important.
Regards.
JJ
LAUJJL
Senior Member
Posts: 1427
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

Find ZEro

Post by LAUJJL »

Hi

Here is joined a model with units.
I had to modkfy the equations that were highly inconsistent.
It has still problems because the find zero is not included in a loop without stocks. It cannot loop to find the optimal solution.
you should study closely the prion example, to have an example of use of find zero.
It seems that you have not understood how the find zero works.
I have some examples in my models too, but they are complicate to explain.
Ir should be useful to explain exactly what you are trying to do, because I do not understand exactly the objective of the model.
Regards.
JJ
Attachments
Diopol2.mdl
(6.44 KiB) Downloaded 365 times
addor
Senior Member
Posts: 50
Joined: Mon Oct 27, 2003 9:45 am

dimensions

Post by addor »

Thank you, JJ, for your details. I'm afraid that I was not able to explain you, that my variables don't have dimensions like Euro or Euro/widget. E.g. the market price is a relative price and a fraction of 1. 1 is the prohibitive price and has no dimension. So I had to put dmnl everywhere. Sorry, that I omit it. Also the total market is 1.

I know that it is difficult to empathise in a model from another person. My model is a very simple diopolistic situation close to Cournots Dioploy, that is usally caculated dimensionless with relative sizes.

You are right I didn't understand how the "find zero" works. That's why I asked here for help. I understood the simple example in the manual where x is the find zero with variable z, and z is the equation in x to be solved. Normally however z is a parameter that is based on variables used otherwhere in the model.

In my model the equation that has to be zerod is in the variables "market share of A" and "market share of B". So the parameter with the "find zero" function cannot have the name "market share of A".

Regards,
Peter
Attachments
Diopol3.mdl
(4.75 KiB) Downloaded 360 times
Peter Addor
LAUJJL
Senior Member
Posts: 1427
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

find zero

Post by LAUJJL »

Hi Peter

You should, before sending a model, both checks, the equations and the units.
Both have mistakes.
There are no values and no units for the derivatives.
The price market equal to exp(- market share of a - market share of b) is equal to exp (-1) that is constant.
or the price will vary with the repartition of the market share between the two competitors.
It should be minimum when both market shares are equal and maximum when one market share is equal to 1.

This should be implemented in a set or reality check equations that would help explain your model to somewhere else and check its compliance to the expected behaviours.
Reality checks are to my opinion the second great advantages of the method againts other methods and should be automatically applied in any model.
If someone asks me to bet on the credibility of a model that I have never seen, I will double my bet if the model has exhaustive reality checks built in.

You have still not understood how find zero works and I doubt that you need that function in your model.
Find zero, finds the zero of a function inside every time step of the model, and loops along a loop without any stock on it, otherwise it would have to wait until the next time step to carry on its research.
Look for the instantaneous function that works the same way that the find zero and is easier to understand.
I will have a look at the Cournot's duopol and try to model it and send it to you.
Where did you find the documentation about Cournot's duopol?
I will look in Google and certainly find documentation.
Regards.
JJ
addor
Senior Member
Posts: 50
Joined: Mon Oct 27, 2003 9:45 am

find zero

Post by addor »

Thanks, JJ. No, you must not model the Cournot Duopol. Thank you for your very kind offer. But my problem is not to model the Cournot's Duoplo but to understand the "Find Zero" function. I have chosen Cournot's Duoplo only as an exercise for "find zero". If you don't think that this is a good example, I like to take another example that is more convenient.

Sorry if I used a confusing expression. Under "total market" I don't understand the sum of A's and B's market share but actually the total demand. Theoretically there can be a big demand for a good but no supply. The price is a function of the supply ("market share of A" + "market share of B"). May be instead of "market share" I should call it "supply share" or something like this. But I imagine the total demand as the potential total market, and so A's and B's supply shares are shares of the potential market.
I see that besides dimensions and units the exact or correct naming of the variable - or a good documentation - is also very important.

In every time step the both players - A and B - have to decide if their market share is lower or higher as the market share that gives the max benefit. So they have to zero the first derivative of the benefit equation. Of course my model is not yet complete as I hesitate to establish such an artificial parameter like a derivative.

And still my problem is, that if I have a parameter "derivative of the benefit" with the variable "market share" then I don't know how to find its zero.

Regards,
Peter
Peter Addor
LAUJJL
Senior Member
Posts: 1427
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

find zero

Post by LAUJJL »

Hi

When I have some time, I will construct a very simplistic model that uses the find zero function and eventually too the instantaneous one.
I did not found the example in the Vensim documentation
difficult to understand as one does not need to understand the whole model but only the part that deals with the zero function.
But wait a bit, and I will do it.
Regards.
JJ
addor
Senior Member
Posts: 50
Joined: Mon Oct 27, 2003 9:45 am

find zero

Post by addor »

Sure, dear JJ, it isn't urgent. I'm looking forward to your example. How do you mean "I did not found the example in the Vensim documentation". If you click on "Help/Vensim Manuals/Reference Manual/Functions and Keywords/Functions E-I/FIND ZERO" then you certainly will see the two examples.
As in the first example I'm able to construct applications for the functions as the added "model". The equation in x is under z, and x is the FIND ZERO parameter. This works very fine.

Peter
Attachments
find_zero.mdl
(1.48 KiB) Downloaded 364 times
Peter Addor
addor
Senior Member
Posts: 50
Joined: Mon Oct 27, 2003 9:45 am

find zero

Post by addor »

Difficulties starts when the equation to be zerod is not in the variable of the Find Zero function.

Look on my example that isn't complete.

x is any time dependent parameter in a greater context.
z is a (nonlienear) equation in x
I'm looking for the zero of z in every time step.

I miss one more arrow starting at the parameter called "Zero".

Regards,
Peter
Attachments
find_zero_uncomplete.mdl
(1.63 KiB) Downloaded 362 times
Peter Addor
LAUJJL
Senior Member
Posts: 1427
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

find zero

Post by LAUJJL »

Hi

When I wrote that I did nof find the example, there was something written after it, difficult.
I know well the two examples, and I mean that I did not find them difficult to understand.
I will send you a very simple application.
Regards.
JJ
LAUJJL
Senior Member
Posts: 1427
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

find zero

Post by LAUJJL »

Hi

attached two examples that correspond to the two examples of the find zero Vensim documentation.
The files are zipped with winzip.
Regards.
JJ
Attachments
ex.zip
(1.98 KiB) Downloaded 372 times
LAUJJL
Senior Member
Posts: 1427
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

find zero simultaneous

Post by LAUJJL »

Hi

Attached the same models but with the simultaneous equations.
Regards.
JJ
Attachments
ex_simultaneous.zip
(2.12 KiB) Downloaded 360 times
LAUJJL
Senior Member
Posts: 1427
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

find zero

Post by LAUJJL »

Hi Peter

Do you understand after my examples, why you model
find zero incomplete cannot work, and stops after the first causal calculation, calculating first x then Z then zero that takes the init value, then stops?
Regards.
JJ
addor
Senior Member
Posts: 50
Joined: Mon Oct 27, 2003 9:45 am

find zero

Post by addor »

Hi JJ. Thaks alot for your patient help. This isn't self-evident especially if I'm such slow in the uptake.

Your models ex1 and ex2 confirmed that I was right when I tried to converted the examples in the manual into models a few days ago. You can be sure that I studied the two examples well before I sent my "cry for help" in this forum.

Sorry, but no, still I don't understand the clou. My question is: can you complete my model find_zero_uncomplete? I guess that there is a missing arrow from "Zero" to anywhere. But neither x nor z depend on Zero.

What if neither "demand" nor "supply" would depend on "price" in your example ex2? Let say "supply" is constant and "demand" is equal to "variable*variable-3*variable+2"
How would you calculate "price"?

Reagrds,
Peter
Peter Addor
bob@vensim.com
Senior Member
Posts: 1107
Joined: Wed Mar 12, 2003 2:46 pm

Post by bob@vensim.com »

Hi Peter,

I am not sure where this thread has traveled, so let me reply to your original post.

In the model you sent you used FIND ZERO in an attempt to have a market share that caused "Growth of Bs benifit" to be zero. But "growth of B's benefit" does not depend on market share, so there is no possible way for this to be done. FIND ZERO works within a single time step. It is a mechanism for solving simultaneous equations. If you think there is a dynamic adjustment process you will need to model that explicitly. For example in your model the growth in market share could depend on relative benefit of A/B.

If you are attempting to solve "fast but stable dynamics" using a simultaneous solution the NEPHRON models are exactly what you want. One uses the SIMULTANEOUS function with a constructed pseudo-dynamic loop. The other uses FIND ZERO (at least that is what I remember). They aren't, unfortunately, any more complicated than any model needs to be that is trying to do something like this.
LAUJJL
Senior Member
Posts: 1427
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

Find zero

Post by LAUJJL »

Hi Peter

What is the ex2 model representing.
Three variables: the price that influences positively the supply and negatively the demand. The variable should not be called variable but constant. Is is badly named. sorry.
So these variables interact and adjust on each other, until an equilibrium is reached, within the time step.
So if the supply is constant, the demand and the price will adjust to this constant. But is will not be necessary to have a step by step adjustment process.
And the problem is to find the supply, the demand and the price that adust to one another. Making the supply constant or the demand, constant, just suppresses the problem.
On top of that, it will not be realistic.
You should spend some time, studying closely the user guide to better understand the philosophy of SD.
Regards.
JJ
addor
Senior Member
Posts: 50
Joined: Mon Oct 27, 2003 9:45 am

find zero

Post by addor »

Thanks, Bob. Yes I studied NEPHRON. It's a pitty that I have to go through the junk of blood pressure etc.

Why is there no "academic" example that solves a polynomial or transcendental equation with a variable that depends explicitly of time? That would be helpful.

Regards,
Peter
Peter Addor
addor
Senior Member
Posts: 50
Joined: Mon Oct 27, 2003 9:45 am

find zero

Post by addor »

Thanks JJ. Well I only read Sterman's "Business Dynamics", but - well - I will have a closer look to the user guide too. Nevertheless I don't think that "find zero" is a typical SD function.

You remember when I asked for modelling of Bellman's approach? You wrote, that you also tried this while Bob suggested to use FIND ZERO. You don't have an example of a Bellman or at least Lagrangian model based on FIND ZERO?

Regards,
Peter
Peter Addor
LAUJJL
Senior Member
Posts: 1427
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

find zero

Post by LAUJJL »

I studied too the nephron model that deals with the find zero and the corresponding nearly identical model with the simultaneous. You do not need to study the whole model to understand how it works, but only the two equations involved!
I was first upset too considering the necessity to study the whole model, but realized that it was not necessary.
I tried to model the Bellman's algorithm but it does not work with SD, and even if it worked it would be limited to no more than 6 or 7 time steps. the problem with dynamic or Bellmann programming is that the need of calculation power grows very quickly with the time steps. It is then generally useless.
But I do not think that find zero pays any role in dynamic programming where you find an optimum through a dertemined number of time steps, while find zero just makes an adjustment between different variables according to different fixed rules inside a time step.
To help you further, it would be good to have an idea of the
problem you are trying to solve, because you may be do not need find zero at all.
Where are you working?
What kind of problem are you tyrin to solve?
Regards.
JJ
addor
Senior Member
Posts: 50
Joined: Mon Oct 27, 2003 9:45 am

optimization

Post by addor »

I'm working in Zurich, and give lectures for mathematics and management operations at several instututes. Occasionally I'm trying to combine game theory and System Thinking, e.g. when I show connections between non-cooperative game archetypes and the Senge's archetypes. A special field in game theory is "differential games". While classical game theory treats rather statical situation, differential games take a dynamical point of view in considerations. A central element of differential games is optimization because the optimum represents often a Nash equilibrium. That's why I'm interested in modelling optimization with SD (Bellman or only Lagrangian where you have to solve equations like f(x)=0)
Peter Addor
bob@vensim.com
Senior Member
Posts: 1107
Joined: Wed Mar 12, 2003 2:46 pm

Post by bob@vensim.com »

Hi Peter,

FIND ZERO does exactly implement f(x)=0. I think the problem you are having is that you are thinking the implied dynamics in such an equation should manifest in the models - they don't. From Vensim's perspective f(x)=0 is a completely nondynamic equation trying to find a set of values for x the give 0. The only dynamics come from the changes in environmental conditions resulting from things outside the determination of x.

If you want the gamers to use and optimize a dynamic model of the game (either rational expectations style or not) then then problem is more difficult - you can write an external function in Vensim that opens and optimizes another Vensim model and then returns the results but that is prety difficult.
Post Reply