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

Sage thinks that I^(2/3) = -1 #30783

Closed
mezzarobba opened this issue Oct 17, 2020 · 11 comments
Closed

Sage thinks that I^(2/3) = -1 #30783

mezzarobba opened this issue Oct 17, 2020 · 11 comments

Comments

@mezzarobba
Copy link
Member

Revert #25218.

Rationale: #25218 makes a^(p/q) where a is a number field element attempt to return a solution to a^p = x^q in the number field. This makes powering inconsistent with coercions, since number fields often (and, in the case of quadratic fields, automatically) come with a complex embedding and complex numbers of various kinds use the principal branch of the power function.

Among other confusing behaviors, we have

sage: I^(2/3)
I^(2/3)
sage: QQbar(I^(2/3))
0.500000000000000? + 0.866025403784439?*I
sage: QQbar(I)^(2/3)
0.500000000000000? + 0.866025403784439?*I

but

sage: I.pyobject()^(2/3)
-1

and

sage: QQi.<i> = QuadraticField(-1)
sage: i^(2/3)
-1

but

sage: QQbar(i)^(2/3)
0.500000000000000? + 0.866025403784439?*I

as well as

sage: CC((i^(1/6))^2)
0.866025403784439 + 0.500000000000000*I
sage: CC((i^(1/3)))
-1.00000000000000*I
sage: i^(1/3)*CC(i)^(1/3)
0.500000000000000 - 0.866025403784439*I

CC: @BrentBaccala

Component: basic arithmetic

Author: Marc Mezzarobba

Branch/Commit: 0807787

Reviewer: Sébastien Labbé

Issue created by migration from https://trac.sagemath.org/ticket/30783

@sagetrac-tmonteil
Copy link
Mannequin

sagetrac-tmonteil mannequin commented Oct 17, 2020

comment:1

Hi Marc, could you please provide more details about this ticket ? Currently (9.2.rc2), we have:

sage: I^(2/3)                                                                                                                                                                                                
I^(2/3)
sage: _.n()                                                                                                                                                                                                  
0.500000000000000 + 0.866025403784439*I

@mezzarobba
Copy link
Member Author

comment:2

Sorry, I didn't have time yesterday. This happens for i ∈ ℚ[i], not i ∈ SR (see the linked ticket). But note that #18036 aims to make the glbal symbol i refer to the generator of ℚ[i]. (In fact, I am currently trying again to make that change, and that's how I discovered the issue.)

@seblabbe
Copy link
Contributor

comment:3

Oups, I made a mistake while reviewing #25218. Feel free to fix that to the correct thing.

@mezzarobba

This comment has been minimized.

@mezzarobba
Copy link
Member Author

New commits:

38771d3Revert "25218: space fixes"
3aae21dRevert "Trac #25218: fix typo"
0807787Revert "Trac #25218: NumberField attempts to evaluate fractional powers"

@mezzarobba
Copy link
Member Author

Author: Marc Mezzarobba

@mezzarobba
Copy link
Member Author

Commit: 0807787

@mezzarobba
Copy link
Member Author

Branch: u/mmezzarobba/30783-revert_25218

@seblabbe
Copy link
Contributor

comment:5

I confirm with the branch I get this:

sage: QQi.<i> = QuadraticField(-1)                                                                   
sage: i^(2/3)                                                                                        
I^(2/3)                                                 
sage: n(_)                                                                                           
0.500000000000000 + 0.866025403784439*I

Bot is green (except for startup time which I think we can ignore because this ticket does not change anything regarding to that).

@seblabbe
Copy link
Contributor

Reviewer: Sébastien Labbé

@mkoeppe mkoeppe modified the milestones: sage-9.2, sage-9.3 Oct 24, 2020
@vbraun
Copy link
Member

vbraun commented Nov 1, 2020

Changed branch from u/mmezzarobba/30783-revert_25218 to 0807787

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

4 participants