I found the cis
function in Base, which defined as cis(x) = cos(x) + i sin(x)
, but the cas
function is not, which defined as cas(x) = cos(x) + sin(x)
. although one can get the cas
as sum(sincos(x))
, but it'll be consistent and convenient that the cas
functions been included in Base.
Info about the cis
and cas
can be found in wiki
The 2 arguments against cas are that it is pretty rare, and that if you need it, it's just sqrt(2)sin(x+pi/4)
.
Also cas
is a common abbreviation. Until I read the issue, I assumed it was about compare-and-swap. I don't think I've ever come across cas
in any of my mathematical work.
The cas
function is the kernel of Hartley Transform which is very similar to Fourier Transform, and there are algorithms for Discrete Fast Hartley Transform which may be of interest. I bring this up mainly because I found the cis
function is already in Base which is just an alias of exp(ix)
, then I thought why not include cas
, it's just a one liner.
I'm ok to deprecate and remove cis
from Base.
@Keno, I understand, if we want a clean Base, defer out functions to external packages may be a good idea, but since packages can add methods to base function, I can't image unreconcilable cases if they are included in the Base, is there any other reason, or criterion for whether include functions in Base?
Yes, in general a method should have a good reason for being in Base. Either it's used super commonly, so it should always be available, or it's used semi-commonly, but hard to implement, or it's used not-so often, but needs Base support to be performant. Those are basically the cases when we put things in Base. Obviously historically we weren't quite so strict about what goes in Base, so there's a lot of stuff in there that maybe we wouldn't put in there these days, but that's no reason to add more. Putting something in base essentially reserves the name globally in the package ecosystem and as I mentioned above, there's a good reason to not want to do that for cas
(because somebody might want to use it with a different meaning).
Indeed, the Base needs to clean up a bit.
Most helpful comment
Also
cas
is a common abbreviation. Until I read the issue, I assumed it was about compare-and-swap. I don't think I've ever come acrosscas
in any of my mathematical work.