QuoteOriginally posted by: CuchulainnQuoteOriginally posted by: frolloosQuoteOriginally posted by: CuchulainnFrolloos,I see Matlab does support isnanMaybe try to put in some statements to pinpoint. In any case sqrt(x) ==> NaN for x < 0.Yes I'll have to debug. Thought I was out of the woods with (0,inf), but when I ran the code with T > 0.5 I get more NaNs. Matlab says infinity encountered.It's a start
the first NaN is a symptom of something more serious? I once solved a problem that only crashed for vol = 62.32... But it was tip of ye olde ijsberg.Looked at the Matlab documentation but didn't find anything particularly illuminating. Not sure what is meant with 'decays sufficiently rapidly': (will contact them tomorrow and ask them 'watskebeurd'
)"If the interval is infinite, [a,Inf), then for the integral of fun(x) to exist, fun(x) must decay as x approaches infinity, and quadgk requires it to decay rapidly. Special methods should be used for oscillatory functions on infinite intervals, but quadgk can be used if fun(x) decays fast enough.The quadgk function will integrate functions that are singular at finite endpoints if the singularities are not too strong. For example, it will integrate functions that behave at an endpoint c like log|x-c| or |x-c|p for p >= -1/2. If the function is singular at points inside (a,b), write the integral as a sum of integrals over subintervals with the singular points as endpoints, compute them with quadgk, and add the results"