Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to indicate that UDF didn't converge?
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 -- MrShort ----------------------------------------------------------------------- MrShorty's Profile: http://www.excelforum.com/member.php...fo&userid=2218 View this thread: http://www.excelforum.com/showthread.php?threadid=49559 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
converge tabs | Excel Discussion (Misc queries) |