bugGNU Octave - Bugs: bug #62972, 2D integrals conjugate complex...

 
 

bug #62972: 2D integrals conjugate complex numbers

Submitter:  oshbug
Submitted:  Sun 28 Aug 2022 03:00:41 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * 7.2.0 Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 30 Aug 2022 08:53:11 PM UTC, comment #5: 

I added a BIST test for this bug report just so the behavior isn't accidentally reverted in the future (http://hg.savannah.gnu.org/hgweb/octave/rev/1c40fc2344f4).

Marking bug as Fixed and closing report.

Rik <rik5>
Group administrator
Sun 28 Aug 2022 04:31:12 PM UTC, comment #4: 

Pushed to stable here: https://hg.savannah.gnu.org/hgweb/octave/rev/b0e90ca8e679

Marking as ready for test.

If all goes well, this fix will be in Octave 7.3. If you need it before then, you can change ' to .' in the two lines indicated in the patch above.

Arun Giridhar <arungiridhar>
Group Member
Sun 28 Aug 2022 04:00:38 PM UTC, comment #3: 

Confirmed. I think the problem is in lines 409 and 410 of quad2d.m, where the conjugate transpose it taken (') instead of the real transpose (.').
By the way, integral does not work with complex input, but this requires another bug report.

Marco Caliari <caliari>
Group Member
Sun 28 Aug 2022 03:59:50 PM UTC, comment #2: 

I can confirm these results with a build from a current head of the default branch on Windows.

Fwiw, the results with Matlab R2022a:

>> integral2(@(x,y) 1i*ones(size(x)), 0,1,0,1)

ans =

   0.0000 + 1.0000i

>> quad2d(@(x,y) 1i*ones(size(x)), 0,1,0,1)

ans =

   0.0000 + 1.0000i


Markus Mützel <mmuetzel>
Group administrator
Sun 28 Aug 2022 03:58:12 PM UTC, comment #1: 

Confirmed. It seems the bug is because we are using the ' operator (conjugate transpose) instead of the .' operator (plain transpose).

I'll post a fix today.

Arun Giridhar <arungiridhar>
Group Member
Sun 28 Aug 2022 03:00:41 PM UTC, original submission:  

Both of


quad2d(@(x,y) i, 0,1,0,1)
integral2(@(x,y) i, 0,1,0,1)


give the answer to this integral as 0-1i, but clearly it is 0+1i. This is confirmed by Wolfram Alpha:
https://www.wolframalpha.com/input?i=Integrate+i+dx+dy+from+x%3D0+to+x%3D1+and+y%3D0+to+y%3D1

Generally, it seems that both these functions correctly integrate functions with complex outputs, but then return the complex conjugate of the correct answer. E.g. if the answer should be 1+i, they return 1-i.

oshbug

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by caliari (Posted a comment)
  • -email is unavailable- added by mmuetzel (Posted a comment)
  • -email is unavailable- added by arungiridhar (Posted a comment)
  • -email is unavailable- added by oshbug (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-08-30 rik5 StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2022-08-28 arungiridhar StatusNone Ready For Test
    2022-08-28 caliari StatusConfirmed None
        Operating SystemAny GNU/Linux
    2022-08-28 mmuetzel Operating SystemGNU/Linux Any
    2022-08-28 arungiridhar StatusNone Confirmed

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code