octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #58636] Integral fails to call quadgk for comp


From: Nicholas Jankowski
Subject: [Octave-bug-tracker] [bug #58636] Integral fails to call quadgk for complex integration
Date: Sat, 20 Jun 2020 16:19:38 -0400 (EDT)
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36

URL:
  <https://savannah.gnu.org/bugs/?58636>

                 Summary: Integral fails to call quadgk for complex
integration
                 Project: GNU Octave
            Submitted by: nrjank
            Submitted on: Sat 20 Jun 2020 04:19:36 PM EDT
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Unexpected Error
                  Status: None
             Assigned to: None
         Originator Name: Nicholas Jankowski
        Originator Email: 
             Open/Closed: Open
                 Release: 5.2.0
         Discussion Lock: Any
        Operating System: Any

    _______________________________________________________

Details:

As reported by Brett on the mailing list [1]:

Integral is a wrapper for quadcc, quadgk, and quadv, and defaults to quadcc
where possible. quadgk is the only quadrature method built for complex
integration and limits, including complex path integration, and should be
called.  There is currently no check for complex functions or limits, so if
waypoints are not specified the script chooses quadcc which issues an error,
while both quadgk and quadv would have successfully computed the result.

Complex function case:

>> fx = @(x) (x+i.*3).^2;
>> cmplx_int_val = integral(fx,-1,2)
error: quadcc: integrand F must return a single, real-valued vector
error: called from
    integral at line 114 column 7
>> cmplx_int_val = quadcc(fx,-1,2)
error: quadcc: integrand F must return a single, real-valued vector
>> cmplx_int_val = quadgk(fx,-1,2)
cmplx_int_val = -24.0000 +  9.0000i
>> cmplx_int_val = quadv(fx,-1,2)
cmplx_int_val = -24 +  9i


Complex limits case:

>> fx = @(x) (x).^2;
>> cmplx_int_val = integral(fx,-i,i)
error: quadcc: lower limit of integration (A) must be a real scalar
error: called from
    integral at line 114 column 7
>> cmplx_int_val = quadcc(fx,-i,i)
error: quadcc: lower limit of integration (A) must be a real scalar
>> cmplx_int_val = quadgk(fx,-i,i)
cmplx_int_val =  0.00000 - 0.66667i
>> cmplx_int_val = quadv(fx,-i,i)
cmplx_int_val = -0.00000 - 0.66667i


the isreal check on the limits should be easy enough.  the check on the
function may be a bit more complicated, and I'm not sure the best way to check
that.

it would be inefficient, but lacking something better could just if (catch
specific complex error message from quadcc) --> kick it to quadgk.  

better suggestions welcome

(also, need to fix the docs for any change including fixing the preamble to
the one function integration section that doesn't mention integral calls
quadcc)

[1]
https://octave.1599824.n4.nabble.com/Why-is-there-no-function-for-complex-integrals-tp4697602.html




    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?58636>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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