Skip to content

Add complex number support to negative - #448

Merged
kgryte merged 1 commit into
mainfrom
cmplx-negative
Jun 6, 2022
Merged

Add complex number support to negative#448
kgryte merged 1 commit into
mainfrom
cmplx-negative

Conversation

@kgryte

Copy link
Copy Markdown
Contributor

This PR

  • adds complex number support to negative (and __neg__). No special considerations need to be made for complex numbers, as negative follows the rules of complex number multiplication

    $$\textrm{negative}(z_i) = -1\cdot z_i = (-1+0j)\cdot z_i =(-1+0j)\cdot(a_i + b_ij) = (-1a_i + 0b_i) + (0a_i - 1b_i)j = -a_i - b_ij$$

    where $a_i = \textrm{Re}(z_i)$ and $b_i = \textrm{Im}(z_i)$.

@kgrytekgryte added API change Changes to existing functions or objects in the API. topic: Complex Data Types Complex number data types. labels May 30, 2022
@kgrytekgryte added this to the v2022 milestone May 30, 2022
@kgryte

Copy link
Copy Markdown
ContributorAuthor

Thanks, @leofang! Will merge, as the changes are straightforward and align with existing array implementations.

@kgryte
kgryte merged commit ac7ce5d into mainJun 6, 2022
@kgryte
kgryte deleted the cmplx-negative branch June 6, 2022 19:59
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

API changeChanges to existing functions or objects in the API.topic: Complex Data TypesComplex number data types.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@kgryte@leofang