M
MrShorty
I have a handful of UDF's that use iterative algorithms to numericall
arrive at a solution (usually either a Newton-Raphson type algorithm o
successive approximations). I like to put a check on the number o
iterations, to prevent getting stuck in an infinite loop should th
problem diverge. Generic function looks something like:
function myudf(arglist, optional init)
if ismissing(init) then init= some reasonable initial guess for generi
problems of this sort
code setting up initial values for the iteration
it=0
do
it=it+1
iteration code to find next value from old value
loop until convergeance criteria or it>=100
myudf=result
end function
What I would like to add is something to let me know when th
convergeance criteria hasn't been met, but rather the function ha
ended because we've reached the maximum number of iterations. I'm jus
looking for ideas. How would you inform me that the function reache
maxiterations without converging? message box? have the functio
return an error? other possibility?
Thanks in advance
arrive at a solution (usually either a Newton-Raphson type algorithm o
successive approximations). I like to put a check on the number o
iterations, to prevent getting stuck in an infinite loop should th
problem diverge. Generic function looks something like:
function myudf(arglist, optional init)
if ismissing(init) then init= some reasonable initial guess for generi
problems of this sort
code setting up initial values for the iteration
it=0
do
it=it+1
iteration code to find next value from old value
loop until convergeance criteria or it>=100
myudf=result
end function
What I would like to add is something to let me know when th
convergeance criteria hasn't been met, but rather the function ha
ended because we've reached the maximum number of iterations. I'm jus
looking for ideas. How would you inform me that the function reache
maxiterations without converging? message box? have the functio
return an error? other possibility?
Thanks in advance