# [jira] [Created] (MATH-620) multiplication of infinity

19 messages
Open this post in threaded view
|

## [jira] [Created] (MATH-620) multiplication of infinity

 multiplication of infinity --------------------------                  Key: MATH-620                  URL: https://issues.apache.org/jira/browse/MATH-620             Project: Commons Math           Issue Type: Bug     Affects Versions: 3.0             Reporter: Arne Plöse             Priority: Minor Take the following testcase {code} Assert.assertEquals(neginf, inf* neginf, Double.MIN_VALUE);  // <--Passes ordinary double Assert.assertEquals(new Complex(neginf, 0), new Complex(inf, 0).multiply(new Complex(neginf, 0)));// <-- Fail only real parts no imaginary parts {code} The outcome of multiply is Complex.INF if one part is infinity. why not simply compute the multiplication and thats is? -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira
Open this post in threaded view
|

## [jira] [Commented] (MATH-620) multiplication of infinity

 [ https://issues.apache.org/jira/browse/MATH-620?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13065132#comment-13065132 ] Arne Plöse commented on MATH-620: --------------------------------- This goes also wrong: {code}         Assert.assertEquals(new Complex(neginf, nan), new Complex(0, inf).multiply(new Complex(0, inf)));// <-- Fail {code} the result is the output of octave - so I would expect the same. Am Donnerstag, den 14.07.2011, 08:58 +0000 schrieb Arne Plöse (JIRA): > multiplication of infinity > -------------------------- > >                 Key: MATH-620 >                 URL: https://issues.apache.org/jira/browse/MATH-620>             Project: Commons Math >          Issue Type: Bug >    Affects Versions: 3.0 >            Reporter: Arne Plöse >            Priority: Minor > > Take the following testcase > {code} > Assert.assertEquals(neginf, inf* neginf, Double.MIN_VALUE);  // <--Passes ordinary double > Assert.assertEquals(new Complex(neginf, 0), new Complex(inf, 0).multiply(new Complex(neginf, 0)));// <-- Fail only real parts no imaginary parts > {code} > The outcome of multiply is Complex.INF if one part is infinity. > why not simply compute the multiplication and thats is? -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira
Open this post in threaded view
|

## [jira] [Commented] (MATH-620) multiplication of infinity

 In reply to this post by ASF GitHub Bot (Jira)     [ https://issues.apache.org/jira/browse/MATH-620?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13082183#comment-13082183 ] Phil Steitz commented on MATH-620: ---------------------------------- I recommend WONT_FIX.  Looks to me like the behavior matches the javadoc and the current contracts are reasonable, IMO.   > multiplication of infinity > -------------------------- > >                 Key: MATH-620 >                 URL: https://issues.apache.org/jira/browse/MATH-620>             Project: Commons Math >          Issue Type: Bug >    Affects Versions: 3.0 >            Reporter: Arne Plöse >            Priority: Minor > > Take the following testcase > {code} > Assert.assertEquals(neginf, inf* neginf, Double.MIN_VALUE);  // <--Passes ordinary double > Assert.assertEquals(new Complex(neginf, 0), new Complex(inf, 0).multiply(new Complex(neginf, 0)));// <-- Fail only real parts no imaginary parts > {code} > The outcome of multiply is Complex.INF if one part is infinity. > why not simply compute the multiplication and thats is? -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira
Open this post in threaded view
|

## [jira] [Commented] (MATH-620) multiplication of infinity

 In reply to this post by ASF GitHub Bot (Jira)     [ https://issues.apache.org/jira/browse/MATH-620?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13082219#comment-13082219 ] Arne Plöse commented on MATH-620: --------------------------------- evaluate this testcase: {code}     @Test     public void testMultiplyInf() {         Complex z = new Complex(1, neginf);         Complex w = z.multiply(z);         Assert.assertEquals(w.getReal(), neginf, 0);         Assert.assertEquals(w.getImaginary(), neginf, 0);         Assert.assertEquals(w, z.divide(Complex.ONE.divide(z)));     } {code} the result should be -inf -infi but actually is inf + infi ... The division looks also broken... > multiplication of infinity > -------------------------- > >                 Key: MATH-620 >                 URL: https://issues.apache.org/jira/browse/MATH-620>             Project: Commons Math >          Issue Type: Bug >    Affects Versions: 3.0 >            Reporter: Arne Plöse >            Priority: Minor > > Take the following testcase > {code} > Assert.assertEquals(neginf, inf* neginf, Double.MIN_VALUE);  // <--Passes ordinary double > Assert.assertEquals(new Complex(neginf, 0), new Complex(inf, 0).multiply(new Complex(neginf, 0)));// <-- Fail only real parts no imaginary parts > {code} > The outcome of multiply is Complex.INF if one part is infinity. > why not simply compute the multiplication and thats is? -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira
Open this post in threaded view
|

## [jira] [Commented] (MATH-620) multiplication of infinity

 In reply to this post by ASF GitHub Bot (Jira)     [ https://issues.apache.org/jira/browse/MATH-620?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13096432#comment-13096432 ] Gilles commented on MATH-620: ----------------------------- These {quote} Assert.assertEquals(w.getReal(), neginf, 0); Assert.assertEquals(w.getImaginary(), neginf, 0); {quote} behave as intended: all infinities are mapped to a single "point at infinity" (chosen to be "INF" a.k.a. (+inf, +inf)), which IIRC is a way to deal with the infinite number of infinities along all the directions in the complex plane. This one {quote} Assert.assertEquals(w, z.divide(Complex.ONE.divide(z))); {quote} looks wrong indeed. > multiplication of infinity > -------------------------- > >                 Key: MATH-620 >                 URL: https://issues.apache.org/jira/browse/MATH-620>             Project: Commons Math >          Issue Type: Bug >    Affects Versions: 3.0 >            Reporter: Arne Plöse >            Priority: Minor > > Take the following testcase > {code} > Assert.assertEquals(neginf, inf* neginf, Double.MIN_VALUE);  // <--Passes ordinary double > Assert.assertEquals(new Complex(neginf, 0), new Complex(inf, 0).multiply(new Complex(neginf, 0)));// <-- Fail only real parts no imaginary parts > {code} > The outcome of multiply is Complex.INF if one part is infinity. > why not simply compute the multiplication and thats is? -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira
Open this post in threaded view
|

## [jira] [Commented] (MATH-620) multiplication of infinity

 In reply to this post by ASF GitHub Bot (Jira)     [ https://issues.apache.org/jira/browse/MATH-620?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13096444#comment-13096444 ] Gilles commented on MATH-620: ----------------------------- I've create a new ticket for the above: MATH-657 > multiplication of infinity > -------------------------- > >                 Key: MATH-620 >                 URL: https://issues.apache.org/jira/browse/MATH-620>             Project: Commons Math >          Issue Type: Bug >    Affects Versions: 3.0 >            Reporter: Arne Plöse >            Priority: Minor > > Take the following testcase > {code} > Assert.assertEquals(neginf, inf* neginf, Double.MIN_VALUE);  // <--Passes ordinary double > Assert.assertEquals(new Complex(neginf, 0), new Complex(inf, 0).multiply(new Complex(neginf, 0)));// <-- Fail only real parts no imaginary parts > {code} > The outcome of multiply is Complex.INF if one part is infinity. > why not simply compute the multiplication and thats is? -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira
Open this post in threaded view
|

## [jira] [Issue Comment Edited] (MATH-620) multiplication of infinity

 In reply to this post by ASF GitHub Bot (Jira)     [ https://issues.apache.org/jira/browse/MATH-620?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13096444#comment-13096444 ] Gilles edited comment on MATH-620 at 9/2/11 11:04 PM: ------------------------------------------------------ I've created a new ticket for the above: MATH-657       was (Author: erans):     I've create a new ticket for the above: MATH-657   > multiplication of infinity > -------------------------- > >                 Key: MATH-620 >                 URL: https://issues.apache.org/jira/browse/MATH-620>             Project: Commons Math >          Issue Type: Bug >    Affects Versions: 3.0 >            Reporter: Arne Plöse >            Priority: Minor > > Take the following testcase > {code} > Assert.assertEquals(neginf, inf* neginf, Double.MIN_VALUE);  // <--Passes ordinary double > Assert.assertEquals(new Complex(neginf, 0), new Complex(inf, 0).multiply(new Complex(neginf, 0)));// <-- Fail only real parts no imaginary parts > {code} > The outcome of multiply is Complex.INF if one part is infinity. > why not simply compute the multiplication and thats is? -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira
Open this post in threaded view
|

## [jira] [Commented] (MATH-620) multiplication of infinity

 In reply to this post by ASF GitHub Bot (Jira)     [ https://issues.apache.org/jira/browse/MATH-620?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13097103#comment-13097103 ] Arne Plöse commented on MATH-620: --------------------------------- I try to convert some octave *.m files to java, the result from octave and commons math is differently, so maybe I have to implement my own Complex class to get the expected behaviour? > multiplication of infinity > -------------------------- > >                 Key: MATH-620 >                 URL: https://issues.apache.org/jira/browse/MATH-620>             Project: Commons Math >          Issue Type: Bug >    Affects Versions: 3.0 >            Reporter: Arne Plöse >            Priority: Minor > > Take the following testcase > {code} > Assert.assertEquals(neginf, inf* neginf, Double.MIN_VALUE);  // <--Passes ordinary double > Assert.assertEquals(new Complex(neginf, 0), new Complex(inf, 0).multiply(new Complex(neginf, 0)));// <-- Fail only real parts no imaginary parts > {code} > The outcome of multiply is Complex.INF if one part is infinity. > why not simply compute the multiplication and thats is? -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira
Open this post in threaded view
|

## [jira] [Updated] (MATH-620) multiplication of infinity

 In reply to this post by ASF GitHub Bot (Jira)      [ https://issues.apache.org/jira/browse/MATH-620?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Arne Plöse updated MATH-620: ----------------------------     Comment: was deleted (was: I try to convert some octave *.m files to java, the result from octave and commons math is differently, so maybe I have to implement my own Complex class to get the expected behaviour? ) > multiplication of infinity > -------------------------- > >                 Key: MATH-620 >                 URL: https://issues.apache.org/jira/browse/MATH-620>             Project: Commons Math >          Issue Type: Bug >    Affects Versions: 3.0 >            Reporter: Arne Plöse >            Priority: Minor > > Take the following testcase > {code} > Assert.assertEquals(neginf, inf* neginf, Double.MIN_VALUE);  // <--Passes ordinary double > Assert.assertEquals(new Complex(neginf, 0), new Complex(inf, 0).multiply(new Complex(neginf, 0)));// <-- Fail only real parts no imaginary parts > {code} > The outcome of multiply is Complex.INF if one part is infinity. > why not simply compute the multiplication and thats is? -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira
Open this post in threaded view
|

## [jira] [Commented] (MATH-620) multiplication of infinity

 In reply to this post by ASF GitHub Bot (Jira)     [ https://issues.apache.org/jira/browse/MATH-620?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13097118#comment-13097118 ] Gilles commented on MATH-620: ----------------------------- It would be helpful that you construct a complete unit test that compares Commons Math with Octave. Also, there is a discussion, on the "dev" ML (cf. thread with subject "Complex division"), about how operations in "Complex" should behave. Mentioning your problems and requirements might contribute to deciding which way to go. > multiplication of infinity > -------------------------- > >                 Key: MATH-620 >                 URL: https://issues.apache.org/jira/browse/MATH-620>             Project: Commons Math >          Issue Type: Bug >    Affects Versions: 3.0 >            Reporter: Arne Plöse >            Priority: Minor > > Take the following testcase > {code} > Assert.assertEquals(neginf, inf* neginf, Double.MIN_VALUE);  // <--Passes ordinary double > Assert.assertEquals(new Complex(neginf, 0), new Complex(inf, 0).multiply(new Complex(neginf, 0)));// <-- Fail only real parts no imaginary parts > {code} > The outcome of multiply is Complex.INF if one part is infinity. > why not simply compute the multiplication and thats is? -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira
Open this post in threaded view
|

## [jira] [Commented] (MATH-620) multiplication of infinity

 In reply to this post by ASF GitHub Bot (Jira)     [ https://issues.apache.org/jira/browse/MATH-620?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13097155#comment-13097155 ] Gilles commented on MATH-620: ----------------------------- Another bug (IMO) in CM: {code} Complex infInf = new Complex(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY); Assert.assertTrue(infInf.multiply(infInf).isInfinite()); {code} succeeds, but the formula would have produced "NaN" in the real part. Octave computes: {noformat} NaN + Infi {noformat} Added unit test (with alternative expectation) in revision 1165296. > multiplication of infinity > -------------------------- > >                 Key: MATH-620 >                 URL: https://issues.apache.org/jira/browse/MATH-620>             Project: Commons Math >          Issue Type: Bug >    Affects Versions: 3.0 >            Reporter: Arne Plöse >            Priority: Minor > > Take the following testcase > {code} > Assert.assertEquals(neginf, inf* neginf, Double.MIN_VALUE);  // <--Passes ordinary double > Assert.assertEquals(new Complex(neginf, 0), new Complex(inf, 0).multiply(new Complex(neginf, 0)));// <-- Fail only real parts no imaginary parts > {code} > The outcome of multiply is Complex.INF if one part is infinity. > why not simply compute the multiplication and thats is? -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira
Open this post in threaded view
|

## [jira] [Updated] (MATH-620) multiplication of infinity

 In reply to this post by ASF GitHub Bot (Jira)      [ https://issues.apache.org/jira/browse/MATH-620?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Arne Plöse updated MATH-620: ----------------------------     Attachment: ComplexOctaveTest.java Here is the comparision between commons math and octave. I hope this what you want Gilles ;-). > multiplication of infinity > -------------------------- > >                 Key: MATH-620 >                 URL: https://issues.apache.org/jira/browse/MATH-620>             Project: Commons Math >          Issue Type: Bug >    Affects Versions: 3.0 >            Reporter: Arne Plöse >            Priority: Minor >         Attachments: ComplexOctaveTest.java > > > Take the following testcase > {code} > Assert.assertEquals(neginf, inf* neginf, Double.MIN_VALUE);  // <--Passes ordinary double > Assert.assertEquals(new Complex(neginf, 0), new Complex(inf, 0).multiply(new Complex(neginf, 0)));// <-- Fail only real parts no imaginary parts > {code} > The outcome of multiply is Complex.INF if one part is infinity. > why not simply compute the multiplication and thats is? -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira
Open this post in threaded view
|

## [jira] [Commented] (MATH-620) multiplication of infinity

 In reply to this post by ASF GitHub Bot (Jira)     [ https://issues.apache.org/jira/browse/MATH-620?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13101645#comment-13101645 ] Gilles commented on MATH-620: ----------------------------- It's on the right track, but the test method stops as soon as it encounters a difference; thus, we cannot have a complete overview of all the differences with Octave. > multiplication of infinity > -------------------------- > >                 Key: MATH-620 >                 URL: https://issues.apache.org/jira/browse/MATH-620>             Project: Commons Math >          Issue Type: Bug >    Affects Versions: 3.0 >            Reporter: Arne Plöse >            Priority: Minor >         Attachments: ComplexOctaveTest.java > > > Take the following testcase > {code} > Assert.assertEquals(neginf, inf* neginf, Double.MIN_VALUE);  // <--Passes ordinary double > Assert.assertEquals(new Complex(neginf, 0), new Complex(inf, 0).multiply(new Complex(neginf, 0)));// <-- Fail only real parts no imaginary parts > {code} > The outcome of multiply is Complex.INF if one part is infinity. > why not simply compute the multiplication and thats is? -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira
Open this post in threaded view
|

## [jira] [Updated] (MATH-620) multiplication of infinity

 In reply to this post by ASF GitHub Bot (Jira)      [ https://issues.apache.org/jira/browse/MATH-620?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Gilles updated MATH-620: ------------------------     Attachment: arne_tests.zip See what I mean in the attached file. You could readily apply the same layout to new test classes for "subtract", "multiply" and "divide" (which were in "test4" in your file). > multiplication of infinity > -------------------------- > >                 Key: MATH-620 >                 URL: https://issues.apache.org/jira/browse/MATH-620>             Project: Commons Math >          Issue Type: Bug >    Affects Versions: 3.0 >            Reporter: Arne Plöse >            Priority: Minor >         Attachments: ComplexOctaveTest.java, arne_tests.zip > > > Take the following testcase > {code} > Assert.assertEquals(neginf, inf* neginf, Double.MIN_VALUE);  // <--Passes ordinary double > Assert.assertEquals(new Complex(neginf, 0), new Complex(inf, 0).multiply(new Complex(neginf, 0)));// <-- Fail only real parts no imaginary parts > {code} > The outcome of multiply is Complex.INF if one part is infinity. > why not simply compute the multiplication and thats is? -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira
Open this post in threaded view
|

## [jira] [Updated] (MATH-620) multiplication of infinity

 In reply to this post by ASF GitHub Bot (Jira)      [ https://issues.apache.org/jira/browse/MATH-620?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Arne Plöse updated MATH-620: ----------------------------     Attachment: arne_tests.zip added test cases for sud/mul/div fixed sign detection (readable output) replaced Complex.valueOf with new Double(r, i) > multiplication of infinity > -------------------------- > >                 Key: MATH-620 >                 URL: https://issues.apache.org/jira/browse/MATH-620>             Project: Commons Math >          Issue Type: Bug >    Affects Versions: 3.0 >            Reporter: Arne Plöse >            Priority: Minor >         Attachments: ComplexOctaveTest.java, arne_tests.zip, arne_tests.zip > > > Take the following testcase > {code} > Assert.assertEquals(neginf, inf* neginf, Double.MIN_VALUE);  // <--Passes ordinary double > Assert.assertEquals(new Complex(neginf, 0), new Complex(inf, 0).multiply(new Complex(neginf, 0)));// <-- Fail only real parts no imaginary parts > {code} > The outcome of multiply is Complex.INF if one part is infinity. > why not simply compute the multiplication and thats is? -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira
Open this post in threaded view
|

## [jira] [Commented] (MATH-620) multiplication of infinity

 In reply to this post by ASF GitHub Bot (Jira)     [ https://issues.apache.org/jira/browse/MATH-620?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13113944#comment-13113944 ] Gilles commented on MATH-620: ----------------------------- Hi. # I don't really understand the necessity of "getSign". Couldn't you use "Math.signum" for the same purpose? # It would better to merge the assertions on the signs within the main test because, having them separate forces the operation (add, multiply, ...) to be performed 3 times. Really it is the same test (two results must be equal, sign included). # I don't understand the statement with "Complex.valueOf". Did you notice the MATH-667 issue? > multiplication of infinity > -------------------------- > >                 Key: MATH-620 >                 URL: https://issues.apache.org/jira/browse/MATH-620>             Project: Commons Math >          Issue Type: Bug >    Affects Versions: 3.0 >            Reporter: Arne Plöse >            Priority: Minor >         Attachments: ComplexOctaveTest.java, arne_tests.zip, arne_tests.zip > > > Take the following testcase > {code} > Assert.assertEquals(neginf, inf* neginf, Double.MIN_VALUE);  // <--Passes ordinary double > Assert.assertEquals(new Complex(neginf, 0), new Complex(inf, 0).multiply(new Complex(neginf, 0)));// <-- Fail only real parts no imaginary parts > {code} > The outcome of multiply is Complex.INF if one part is infinity. > why not simply compute the multiplication and thats is? -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira
Open this post in threaded view
|

## [jira] [Commented] (MATH-620) multiplication of infinity

 In reply to this post by ASF GitHub Bot (Jira)     [ https://issues.apache.org/jira/browse/MATH-620?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13114528#comment-13114528 ] Arne Plöse commented on MATH-620: --------------------------------- 1. Math.signum: octave makes a distinction between +0 and -0, from the javadocs Math.signum does not. 2. No real need (just more verbose if a case failed) you can collapse them in one test case. 3. valueOf return Complex.NAN id a part is NAN (same for INF) > multiplication of infinity > -------------------------- > >                 Key: MATH-620 >                 URL: https://issues.apache.org/jira/browse/MATH-620>             Project: Commons Math >          Issue Type: Bug >    Affects Versions: 3.0 >            Reporter: Arne Plöse >            Priority: Minor >         Attachments: ComplexOctaveTest.java, arne_tests.zip, arne_tests.zip > > > Take the following testcase > {code} > Assert.assertEquals(neginf, inf* neginf, Double.MIN_VALUE);  // <--Passes ordinary double > Assert.assertEquals(new Complex(neginf, 0), new Complex(inf, 0).multiply(new Complex(neginf, 0)));// <-- Fail only real parts no imaginary parts > {code} > The outcome of multiply is Complex.INF if one part is infinity. > why not simply compute the multiplication and thats is? -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira