Hi,
I have a coupled socioeconomic-water resource model with external inputs.External inputs are prepared by ARMA model.
I tried to do the bifucation analysis using this model and end up with below error.
I tried with diffrent initial condition but did not work.
Any suggetion to overcome this issue is much appreciated.
Thank you very much.
'''Computing curve...
Computing equilibrium curve... [0]
Log(Condition #) = 17.427672
Error occurred in dynamical system computation
Error occurred in dynamical system computation
Error occurred in dynamical system computation
Not converged: [ 3.18995309e+02 0.00000000e+00 0.00000000e+00 4.52863159e-02
-1.22051258e-11 -6.69249545e-10 3.48973767e+04 -1.57169520e+03
-4.43331340e+05 6.42040950e+02 -6.69044221e-02 1.11270072e-01
-4.50679494e-11 1.80293234e+17]
Traceback (most recent call last):
File "model_20160118_py_cont.py", line 267, in <module>
PyCont['EQ1'].forward()
File "/home/romahend/program/lib/python2.7/site-packages/PyDSTool/PyCont/Continuation.py", line 1246, in forward
self._compute(v0=self.initdirec)
File "/home/romahend/program/lib/python2.7/site-packages/PyDSTool/PyCont/Continuation.py", line 1094, in _compute
raise PyDSTool_ExistError("Could not find starting point on curve. Stopping continuation.")
PyDSTool.errors.PyDSTool_ExistError: 'Could not find starting point on curve. Stopping continuation.'
Last edit: Rooban 2016-01-18
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
you shoudl try to calculate the fixed points of the system first, as the bifurcation analysis is always started on them! So in your case something like
should work. If you have trouble finding fixed points, then maybe your default parameters are bad, you made a mistake in the equations or your system has no fixed points..in which case no bifurcation analysis is possible.
Hope that helps,
Gregor
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Greg,
Thank you very much for your help.
While I tried to find the fixed point of system, I have end up with '''ZeroDivisionError: float division by zero'''. Error comes from function didot where k value reached zero and some time it goes less than zero. Actually k is Capital and it cannot goes less than zero. I have set xdomain for k [10,50]. Also found that production (yi) is also less than zero in some time. It can not be. Is this due to the calculation method of fixed point or is some thing wrong in the equation? Your help is much appriciated .
Last edit: Rooban 2016-01-18
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
ok, so first of all I strongly recommend to use more descriptive variable and function names, at least if you ever want to reuse your programs after some time ;)
For now, I included an sys.exit() call shortly before the bifurcation analysis starts, as we are only concernced with the fixed points. For such a big programm it might be good to break it into smaller parts. Secondly, I defined an xdomain in a rough way via a dictionary comprehension to make sure all variables are covered. I also had to increase the maxsearch parameter for the find_fixedpoints function. For now, the function never halted.
Then I tried to integrate the system, to see if there is some converging going on. Even for a small time domain, the integration takes quite a while. I have only seen diverging trajectories so far, maybe you can try yourself by slowly increasing the time domain (I set it manually in the line 'simpleDS.set(tdata = [0,25])' ). You could also try the Radau or Dopri Generators as opposed to Vode, the former are much faster.
Maybe capitalism really is that great, and you simulate the infinite growth without any attracting state :P
But maybe you also made some little mistake in your numerous equations, you could try to start with a smaller model.
Hi Greg,
Thnak you very much for your check.
As I dont have a proper progamming training, this happens. I am learning form you guys.
Did you get the fixedpoints in the simulation? when i tried to do so, I have end up with same issue (Zero division error).
I am thinking about infinite growth of capital which is not possible and how to find the attracting factors. I will check the eqautions and system again.
I tried to use the Radau intregrator but it seems Radau not support codeinsert_start option and end up with compilation error message which says variable defined in codeinsert_start option are notdeclared.
'''~/radau5_temp/SHmodel_vf.c: In function 'vfieldfunc':
~/radau5_temp/SHmodel_vf.c:127: error: 'ub_val' undeclared (first use in this function)""
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Just on the code insert issue: yes, that args option is for python only. Hacking the C is much harder to automate and requires some lower level knowledge. So, those code inserts won't work there. You'd have to read some of the auto-generated C code and try out some insertions there, but in many ways it's not that different. You can post some more questions about that if you dig in further and sadly there's no formal documentation for that.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
did you for sure downloaded and run the python script I modified and attached 'eco_model.py' ? As there the fixed point search is commented out, and it computes trajectories which works for me (although takes some time). Also, the zero division error disappeared even when you try to run the 'find_fixedpoints' function, as I set the xdomain for all variables with the line
DSargs.xdomain = { variable : [0.1,1e6] for variable in icdict }
which just iterates over the keys ( = variable names ) of the icdict and therefore for sure disallows zero for every variable. It never stops though..
Maybe try starting with a smaller model..then you may find the cause for the instability in your system!
G
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Rob,
Thank you very much for your clarification. As i am not familier with C , it might take little bit time to understand and proceed. I hope i can do.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Gerg,
Thank you very much. I used the same script (eco_model.py) and removed the # in find_fixedpoints and it worked but after some calculation, it's end up with zero division error. As you suggested i will try from smaller model and will try to find the issue.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I have a coupled socioeconomic-water resource model with external inputs.External inputs are prepared by ARMA model.
I tried to do the bifucation analysis using this model and end up with below error.
I tried with diffrent initial condition but did not work.
Any suggetion to overcome this issue is much appreciated.
Thank you very much.
'''Computing curve...
Computing equilibrium curve...
[0]
Log(Condition #) = 17.427672
Error occurred in dynamical system computation
Error occurred in dynamical system computation
Error occurred in dynamical system computation
Not converged: [ 3.18995309e+02 0.00000000e+00 0.00000000e+00 4.52863159e-02
-1.22051258e-11 -6.69249545e-10 3.48973767e+04 -1.57169520e+03
-4.43331340e+05 6.42040950e+02 -6.69044221e-02 1.11270072e-01
-4.50679494e-11 1.80293234e+17]
Traceback (most recent call last):
File "model_20160118_py_cont.py", line 267, in <module>
PyCont['EQ1'].forward()
File "/home/romahend/program/lib/python2.7/site-packages/PyDSTool/PyCont/Continuation.py", line 1246, in forward
self._compute(v0=self.initdirec)
File "/home/romahend/program/lib/python2.7/site-packages/PyDSTool/PyCont/Continuation.py", line 1094, in _compute
raise PyDSTool_ExistError("Could not find starting point on curve. Stopping continuation.")
PyDSTool.errors.PyDSTool_ExistError: 'Could not find starting point on curve. Stopping continuation.'
Last edit: Rooban 2016-01-18
Please find the attachement for script.
Hey Rooban,
you shoudl try to calculate the fixed points of the system first, as the bifurcation analysis is always started on them! So in your case something like
fps = find_fixedpoints(simpleDS, n=10, maxsearch = 3000)
should work. If you have trouble finding fixed points, then maybe your default parameters are bad, you made a mistake in the equations or your system has no fixed points..in which case no bifurcation analysis is possible.
Hope that helps,
Gregor
Hi Greg,
Thank you very much for your help.
While I tried to find the fixed point of system, I have end up with '''ZeroDivisionError: float division by zero'''. Error comes from function didot where k value reached zero and some time it goes less than zero. Actually k is Capital and it cannot goes less than zero. I have set xdomain for k [10,50]. Also found that production (yi) is also less than zero in some time. It can not be. Is this due to the calculation method of fixed point or is some thing wrong in the equation? Your help is much appriciated .
Last edit: Rooban 2016-01-18
Hi Robaan,
ok, so first of all I strongly recommend to use more descriptive variable and function names, at least if you ever want to reuse your programs after some time ;)
For now, I included an sys.exit() call shortly before the bifurcation analysis starts, as we are only concernced with the fixed points. For such a big programm it might be good to break it into smaller parts. Secondly, I defined an xdomain in a rough way via a dictionary comprehension to make sure all variables are covered. I also had to increase the maxsearch parameter for the find_fixedpoints function. For now, the function never halted.
Then I tried to integrate the system, to see if there is some converging going on. Even for a small time domain, the integration takes quite a while. I have only seen diverging trajectories so far, maybe you can try yourself by slowly increasing the time domain (I set it manually in the line 'simpleDS.set(tdata = [0,25])' ). You could also try the Radau or Dopri Generators as opposed to Vode, the former are much faster.
Maybe capitalism really is that great, and you simulate the infinite growth without any attracting state :P
But maybe you also made some little mistake in your numerous equations, you could try to start with a smaller model.
Hi Greg,
Thnak you very much for your check.
As I dont have a proper progamming training, this happens. I am learning form you guys.
Did you get the fixedpoints in the simulation? when i tried to do so, I have end up with same issue (Zero division error).
I am thinking about infinite growth of capital which is not possible and how to find the attracting factors. I will check the eqautions and system again.
I tried to use the Radau intregrator but it seems Radau not support codeinsert_start option and end up with compilation error message which says variable defined in codeinsert_start option are notdeclared.
'''~/radau5_temp/SHmodel_vf.c: In function 'vfieldfunc':
~/radau5_temp/SHmodel_vf.c:127: error: 'ub_val' undeclared (first use in this function)""
Just on the code insert issue: yes, that args option is for python only. Hacking the C is much harder to automate and requires some lower level knowledge. So, those code inserts won't work there. You'd have to read some of the auto-generated C code and try out some insertions there, but in many ways it's not that different. You can post some more questions about that if you dig in further and sadly there's no formal documentation for that.
Hi Rooban,
did you for sure downloaded and run the python script I modified and attached 'eco_model.py' ? As there the fixed point search is commented out, and it computes trajectories which works for me (although takes some time). Also, the zero division error disappeared even when you try to run the 'find_fixedpoints' function, as I set the xdomain for all variables with the line
DSargs.xdomain = { variable : [0.1,1e6] for variable in icdict }
which just iterates over the keys ( = variable names ) of the icdict and therefore for sure disallows zero for every variable. It never stops though..
Maybe try starting with a smaller model..then you may find the cause for the instability in your system!
G
Hi Rob,
Thank you very much for your clarification. As i am not familier with C , it might take little bit time to understand and proceed. I hope i can do.
Hi Gerg,
Thank you very much. I used the same script (eco_model.py) and removed the # in find_fixedpoints and it worked but after some calculation, it's end up with zero division error. As you suggested i will try from smaller model and will try to find the issue.