Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal: Add complex cis function #136

Open
Expander opened this issue Nov 30, 2024 · 2 comments
Open

Proposal: Add complex cis function #136

Expander opened this issue Nov 30, 2024 · 2 comments

Comments

@Expander
Copy link

I propose to add the complex variant of the real $\mathrm{cis}$ function. It would be defined as $\mathrm{cis}\colon\mathbb{C}\to\mathbb{C}$ with

$$\mathrm{cis}(z) = \exp(iz) = \exp(-\mathrm{Im}(z))\mathrm{cis}(\mathrm{Re}(z))$$

This complex $\mathrm{cis}$ function has applications in physics and numerical mathematics.

@cuviper
Copy link
Member

cuviper commented Dec 1, 2024

Since there's already fn cis(T) -> Complex<T>, maybe this could be fn into_cis(self) -> Self? Is there any naming precedent from other languages for this form?

@Expander
Copy link
Author

Expander commented Dec 1, 2024

Implementations in other languages that I found so far include:

  • Intel's C++ compiler has only double _Complex cis(double). (I guess in C's naming convention one would have cis for a function with a real and ccis for a function with a complex argument.)
  • Common Lisp has only cis real => complex
  • julia has cis(z::Real) and cis(z::Complex) via function overloading
  • D has Complex!real expi(real y)

So, it could also be named expi or ccis.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants