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

Q.ComplexNumber.fromString( n ) #4

Open
stewdio opened this issue Jun 3, 2019 · 3 comments
Open

Q.ComplexNumber.fromString( n ) #4

stewdio opened this issue Jun 3, 2019 · 3 comments
Labels
Enhancement New feature or request Q.ComplexNumber

Comments

@stewdio
Copy link
Owner

stewdio commented Jun 3, 2019

It’s kind of gross to see matrix definitions that include new Q.ComplexNumber( blah, blah ) rather than something simple like '-i'. Something like this within the Matrix constructor might be nice:

if( typeof n === 'string' ){

     n = Q.ComplexNumber.fromString( n )
}

But that means having to write Q.ComplexNumber.fromString( n )...
So this issue is a note-to-self to write that!

@stewdio stewdio added Enhancement New feature or request Q.ComplexNumber labels Apr 30, 2020
@marwahaha
Copy link
Contributor

An alternative -- pass in an ordered pair (a, b) for the value a+bi.

Altanali added a commit that referenced this issue Aug 13, 2021
Reduce width of palette on creation in a JupyterNotebook via braket()…
@stewdio
Copy link
Owner Author

stewdio commented Feb 4, 2022

@marwahaha I’m confused: Are you suggesting something that differs from the way Q.ComplexNumber has worked from the beginning? (To create a complex number, call new Q.ComplexNumber( real, imaginary ).) I’m suggesting in addition to this existing functionality it would be nice to be able to pass a more human-readable String as an argument that would then be parsed into its correct components. And then Q.Matrix could take advantage of that as well: #38

@marwahaha
Copy link
Contributor

Oh, I see the point here. Disregard my comment; thanks for clarifying.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request Q.ComplexNumber
Projects
None yet
Development

No branches or pull requests

2 participants