- On the applet version of my GRAZE # 1 model, I
sometimes get a runtime error resulting from an exponential
function. The message:
"error while patch 6 4 executing ^ in procedure GROW-
called by procedure GO
math operation produced undefined result
(halted execution of run)"
the function is as follows:
to grow-grass-and-weeds ;; patch procedure
if biomass < 7.5 ;; stage at which growth slows
[set biomass biomass + (((precision (biomass ^ .667) 2)
/ 40) * grassrate)]
; gives about 2.5% daily growth with grassrate 1.0
if biomass >= 7.5
[set biomass biomass + (((precision ((10 - biomass) ^
.667) 2) / 40) * grassrate)]
grassrate varies from 0.0 to 3.0. The runtime errors seem to
happen more when it is set to a higher value. I was able to
control some of these errors with the PRECISION
primitive but they still occur. Any help or advice??
Perhaps I'm going overboard by using an exponential rather
than a geometric progression to model plant growth, but the
math functions should work, right?
Find out what others are learning from conscious attempts at managing wholes,
rather than just positions, agendas, species, problems, or parts:
>>>>> "Peter" == Peter Donovan <pdonovan@...> writes:Peter> On the applet version of my GRAZE # 1 model, I sometimes get a
Peter> runtime error resulting from an exponential function. The
Peter> "error while patch 6 4 executing ^ in procedure GROW-
Peter> GRASS-AND-WEEDS called by procedure GO math operation produced
Peter> undefined result (halted execution of run)"
This will happen if you try to raise zero to a negative power, or if you
tried to raise a negative number to a fractional power. Looks from your
code like it must be the latter.
We'll improve this error message for NetLogo 1.3 so it tells you what
numbers caused the problem.
Seth Tisue / seth@... / (847) 467-2814
lead developer, NetLogo http://ccl.northwestern.edu/netlogo/
Center for Connected Learning and Computer-Based Modeling
School of Education and Social Policy / Department of Computer Science