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

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

[Octave-bug-tracker] [bug #43349] asin() behaves differently from Matlab


From: Rik
Subject: [Octave-bug-tracker] [bug #43349] asin() behaves differently from Matlab for arguments larger than 1
Date: Wed, 08 Oct 2014 23:54:49 +0000
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:32.0) Gecko/20100101 Firefox/32.0

Follow-up Comment #22, bug #43349 (project octave):

Ugh.  This problem just keeps growing.  If I make the fix in rc_asin which
affects real numbers only, then I get a difference between calling the
function on a real array versus a complex array.  With the fix in place I see


octave:12> asin ([1 2])
ans =

   1.5708 + 0.0000i   1.5708 - 1.3170i

octave:13> asin ([1i 2])
ans =

   0.00000 + 0.88137i   1.57080 + 1.31696i


The problem is that when a complex array is created which has real values in
it then the imaginary portion is automatically assigned the value +0.

Thus, I'm now thinking that the solution has to be in asin (Complex) and that
jwe's second solution is the correct way to go.  The phase of a real number
can't be adjusted with a call to complex (x, -0), but that is okay.  The
convention is that the phase has already been determined by the sign of the
real part of x.  If one really must force a phase then you can move the number
off the real axis by adding a small imaginary component.


asin ([2 + i/1e10, 2 - i/1e10])
ans =

   1.5708 + 1.3170i   1.5708 - 1.3170i



    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?43349>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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