Skip to content
New issue

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

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

Already on GitHub? # to your account

Complex Numbers in symengine #264

Closed
muralidhar-nalabothula opened this issue Jan 15, 2019 · 3 comments
Closed

Complex Numbers in symengine #264

muralidhar-nalabothula opened this issue Jan 15, 2019 · 3 comments

Comments

@muralidhar-nalabothula
Copy link

muralidhar-nalabothula commented Jan 15, 2019

Is there a way to convert symengine I to 1j directly so that it's complex values can be used in regular python? The way I'm doing right now is convert to sympy object and then using the built-in complex function but this is computationally expensive. And also how to find real and imaginary parts?

@certik
Copy link
Contributor

certik commented Jan 16, 2019

@ronald00773 did you figure it out? Was your question about how to convert SymEngine's complex type to a Python complex type efficiently? I am going to reopen this until we have a good answer here.

@muralidhar-nalabothula
Copy link
Author

muralidhar-nalabothula commented Jan 17, 2019

@certik. Hi, @isuruf game me a very good answer on stackoverflow. Suppose x is a symengine complex or complex double then

x (in python complex) = (x.real_part()) + float(x.imaginary_part())*1j

This significantly improved the speed.

Sorry for not updating here.Btw there isn't a direct way

@certik
Copy link
Contributor

certik commented Jan 17, 2019

@ronald00773, Isuru just implemented a direct way in #265.

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

No branches or pull requests

2 participants