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.is_real() for some symbolic q produce erroneous results #38600

Open
maxale opened this issue Sep 1, 2024 · 0 comments
Open

q.is_real() for some symbolic q produce erroneous results #38600

maxale opened this issue Sep 1, 2024 · 0 comments

Comments

@maxale
Copy link
Contributor

maxale commented Sep 1, 2024

Initially I thought that q.is_real() is equivalent to q.imag().is_zero(), both of which can produce erroneous results as I reported in #38586. However, it turns out that each of them may produce an incorrect result independently of the other. Hence, I separate the issue with .is_real() here.

In the following example r.imag().is_zero() gives correct True while r.is_real() gives incorrect False:

r = -1/2056*sqrt(2)*(-231043*sqrt(2) + 1682065/4)^(1/4)*cos(1/2*arctan(1/2*sqrt(-67260300684*sqrt(2) + 97845815881)/(38051*sqrt(2) + 20432)))
print( r.n() )
print( r.imag().is_zero() )
print( r.is_real() )

Output:

-0.0118652163874385
True
False

This code was originally posted in #38586 (comment)

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

No branches or pull requests

2 participants