NetLogo: dealing with infinity probability in distribution -


in netlogo, select specific distribution travel distance based on random number. then, based on selected distribution, calculate probability travel number of specific patches @ specific distance. 1 of distributions, probability approaches infinity around 0. creates error when specific distribution selected , 1 of patches turtle (distance = 0). netlogo give error "math operation produced number large netlogo". there way around error, such having netlogo use largest possible number when error pops up?

the code looks this:

to create-window  get_state  get_parms   set 0   set j 0   while [i < windowsize]   [     set j 0     while [j < windowsize]     [       let dist (sqrt (((item j xlist) - xcor)  ^ 2 + ((item ylist) - ycor) ^ 2))       matrix:set window j ((wshape / wscale) * ((dist / wscale) ^ (wshape - 1)) * exp (-((dist / wscale) ^ wshape)))        set j j + 1      ]     set i + 1   ] end   get_state    set state random 3 + 1 end   get_parms    if state = 1 [     set wscale 0.01856659     set wshape 1.43983152]   if state = 2 [     set wscale 0.18418573     set wshape 0.92631983]   if state = 3 [     set wscale 1.07631234     set wshape 1.78987126] end 

state 2 1 problem (if distance 0), want able change parameters, i'd prefer not use if function based on state number or parameter values..

you have 2 options:

1) modify code calculates probability not produce error in first place, detecting 0 case , doing special. (i can't more specific without knowing code looks like.)

2) wrap calculation of probability using carefully primitive (dictionary entry), trapping error , preventing halting model.

also, how can probability approach infinity? shouldn't approach 1.0?


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

How to get multiresult with multicondition in Sql Server -