I have a systems dynamics model in AnyLogic in which I'm trying to model the Fibonacci sequence. Yet, for some reason, my results differ from the expected ones:
Instead of
1,1,2,3,5,8,13...
I get
1, 2.137954153, 4.021788196, 7.471205823, 13.86070806...
I followed these (spanish) instructions to build my simple model.
I suppose this is not common to all software because in VenSim this example seems to work perfectly...
Can somebody explain to me why this happens in my AnyLogic program?
The reason why this happens is because of the way differential equations are handled in each Software.
The reason you are getting the fibonacci sequence in vensim is because you are using Euler method with time step 1 (check in model settings)
If you change the integration type to RK45 in Vensim or if you reduce the time step using euler's method, you will probably get the same results as AnyLogic gets... Runge-Kutta method even though it starts with the fixed step of 1, it later changes the time step depending on the requirements of the dynamics of the model.
Now, let's understand that using a time-step of 1 is ridiculous in any practical application... But THAT'S WHy you get exact values in vensim... because those exact values are really extremely inaccurate for what the model really is. I would even say that the model on your link is a bad model and shouldn't be ever shown to the public.
Fortunately, AnyLogic doesn't allow you to do that. You can set up a time step of 1 in the model properties, but it will discover the inaccuracies immediately and change the time step to something much smaller (maybe 0.01)... Since it only allows to use Euler+Newton in the mixed equations option, but not Euler alone.
来源:https://stackoverflow.com/questions/49098312/systems-dynamics-in-anylogic-fibonacci-sequence