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 f


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

Update of bug #43349 (project octave):

                  Status:               Need Info => Confirmed              

    _______________________________________________________

Follow-up Comment #4:

The code in question is in liboctave/numeric/lo-mappers.cc:


Complex
asin (const Complex& x)
{
  static Complex i (0, 1);

  return -i * log (i*x + sqrt (1.0 - x*x));
}


It would be possible to put a test on the sign of the real part of x to get
the same result as Matlab.  Conceptually, this is


  return -i * log (i*x + signum (real (x)) * sqrt (1.0 - x*x));


But I'm not sure it is worth it.  sin (asin (x)) returns x in either case
which seems to be the more important thing.

According to Matlab's documentation:


On the branch cut, the values of arcsin coincide with the limit "from below"
for real arguments x > 1. The values coincide with the limit "from above" for
real x < - 1:


Not everyone gets a vote, but I see that Mathematica also returns the same
branch cut values as Matlab.

If this gets changed, then probably all of the functions in lo-mappers.cc that
involve branch cuts should be reviewed.



    _______________________________________________________

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]