[SciPy-Dev] Feature proposal: automatic branch selection for arcsin(), arccos()
Tue Mar 12 12:59:53 CDT 2013
If the function relies on stored state, won't there be issues if you call
the function from different places in your code "simultaneously"?
On Mar 12, 2013 4:41 AM, "Filip Dominec" <email@example.com> wrote:
> Dear scipy developers,
> it is well known that arccos(cos(x)) or similar expressions do not
> always return the value of the original argument, x. In this case, the
> sign as well as any 2*pi*n offset are lost by this operation; in other
> words, the solution of arccos() has many branches.
> For certain applications, however, it is necessary to reconstruct the
> original data, x, without any discontinuities. I have implemented such
> a proof-of-concept function for arccos_continuous(), which
> automatically switches the branch of solution so that the result of
> arccos_continuous(cos(x))==x, if the initial offset and sign are
> Moreover, after having spent next few evenings experimenting, I also
> * reimplemented the algorithm so that it does not explicitly process
> the arrays point-by-point, but it only uses the numpy/scipy functions
> that operate on the whole array efficiently;
> * enabled output and input of the internal branch selection variables
> (so the x array may be split into several blocks, and still the
> arccos_continuous() does not forget the branch between consecutive
> Do you think such functions could be added to scipy, probably in some
> sub-module? Branch-aware version of arccos() is crucial, e. g., for
> elegant computation of metamaterial effective parameters.
> I am looking forward to read your comments,
> SciPy-Dev mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the SciPy-Dev