commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Phil Steitz <phil.ste...@gmail.com>
Subject Re: [math] Complex division WASRe [jira] [Commented] (MATH-657) Division by zero
Date Mon, 05 Sep 2011 15:41:47 GMT
On 9/5/11 7:21 AM, Gilles Sadowski wrote:
> On Mon, Sep 05, 2011 at 02:15:30PM +0200, Arne Ploese wrote:
>> To make things clear here some octave (matlab as well) calculation with
>> complex:
>>
>> octave:1> a = Inf + sqrt(-Inf)
>> a = Inf + Infi
>> octave:2> a * a
>> ans = NaN + Infi
>> octave:3> a = Inf + sqrt(-1)
>> a = Inf +   1i
>> octave:4> a * a
>> ans = Inf + Infi
>> octave:5> a = 1 + sqrt(-Inf)
>> a =    1 + Infi
>> octave:6> a * a
>> ans = -Inf + Infi
>> octave:7> a = 1 - sqrt(-Inf)
>> a =    1 - Infi
>> octave:8> a * a
>> ans = -Inf - Infi
>>
>> Maybe Im wrong but I thought that was the result I could expect from
>> commons math too.
> It seems that the above outputs result from a direct application of the
> computational formula (whereas.
> As I suggested on JIRA, a complete set of comparisons, as a unit test, would
> be most helpful to check where the discrepancies occur.
>
>> In electrical engineering there is a difference if you have + or - 90
>> degree phase shift, the tan will be +infinity or -infinity...
>> If you math guys tell me that there is really no difference with complex
>> numbers - I can live with it (Even if I dont understand why ;-)). 
> What would be really interesting is to know when the final result of the
> DSP algorithm differ between Octave and the Java translation using CM.

Right, that's what I am having trouble finding good examples for. 
My own apps don't seem to be affected by the different choices - but
they tend to treat "divergence to an infinity" or "divergence to
NaN" similarly, so are not good test cases.  I suspect that in most
practical use cases, the differences in behavior will most likely be
on exception paths, but I would be very interested in hearing about
examples where people actually depend on either a) attempts to
faithfully model the Riemann Sphere (so infinities get collapsed) or
b) computation with signed infinities and even elements including
NaNs and infinities (as C99x appears to allow).

I can't find a clear statement in the Octave docs on exactly how
complex arithmetic (or other) functions are defined.  A decent
hypothesis is that it uses GCC under the covers, so it should be
more or less trying to do C99x (though depending on the version,
there are some spec compliance bugs reported).  Could be I am
looking in the wrong place [1] for the docs.  Does anyone know where
this is documented?

Phil

[1] http://www.gnu.org/software/octave/doc/interpreter/
>
>
> Regards,
> Gilles
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message