help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how do detect a complex function?


From: Brett Green
Subject: Re: how do detect a complex function?
Date: Sat, 20 Jun 2020 16:38:46 -0400

On Sat, Jun 20, 2020 at 4:29 PM Nicholas Jankowski <jankowskin@asme.org> wrote:
regarding https://savannah.gnu.org/bugs/index.php?58636

integral calls quadcc, quadgk, quadv.  quadcc is the 'default' when there's nothing special, as i think it's faster than the others and generally applicable. it can't handle complex functions or limits, though, and integral fails to check for that.  the complex limit check is trivial, but I'm not sure how one would check for a complex function.

absent the ability to check, I could abandon use of quadcc (boo slow), or let quadcc try, catch the error, and if it's a complex related error redirect it to quadgk.  that seems messy and inefficient. 

suggestions?  


How inefficient would it be? It seems to me that for most cases, complex numbers would be returned at the first function evaluation.

Perhaps a start would be to evaluate the function at the limits of integration and check whether either returned value is complex. If either is, use quadgk. If not, try quadcc. If quadcc throws an error, then you can catch it and redirect to quadgk.

Obviously this check wouldn't catch every complex function, but it should get most. The error-catching approach then becomes a failsafe rather than the default.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]