Opened 4 years ago
Closed 4 years ago
#22026 closed defect (fixed)
Doctests: Even reals are integers
Reported by:  pelegm  Owned by:  

Priority:  major  Milestone:  sage8.0 
Component:  symbolics  Keywords:  is_integer, assume 
Cc:  Merged in:  
Authors:  Ralf Stephan  Reviewers:  Travis Scrimshaw 
Report Upstream:  N/A  Work issues:  
Branch:  81e3fba (Commits, GitHub, GitLab)  Commit:  81e3fbabc4d05832f20d04ff216e112e607aa1d1 
Dependencies:  #22219  Stopgaps: 
Description (last modified by )
Check this:
sage: assume(x, 'even') sage: assume(x, 'real') sage: simplify((1)**x) 1 sage: x.is_integer() False
At least for real numbers (or even for complex numbers), an even number should be assumed to be an integer.
This is how it works in SymPy:
In [2]: x = Symbol('x', even=True) In [3]: x.is_integer Out[3]: True
Was supposed to be fixed in pynac0.7.4. This will also work and should be doctested here:
sage: sage: assume(x, 'even') ....: sage: assume(x, 'real') ....: sage: (1)^x 1 sage: (gamma(pi))^x gamma(pi)^x
Change History (11)
comment:1 Changed 4 years ago by
comment:2 Changed 4 years ago by
Yes, Maxima knows. The inference logic however is in Pynac.
comment:3 Changed 4 years ago by
 Report Upstream changed from N/A to Reported upstream. Developers acknowledge bug.
This is now https://github.com/pynac/pynac/issues/225
comment:4 Changed 4 years ago by
 Dependencies set to pynac0.7.4
comment:5 Changed 4 years ago by
 Description modified (diff)
 Report Upstream changed from Reported upstream. Developers acknowledge bug. to Fixed upstream, but not in a stable release.
comment:7 Changed 4 years ago by
 Summary changed from Even reals are integers to Doctests: Even reals are integers
Issue is fixed. Only doctests needed.
comment:8 Changed 4 years ago by
 Branch set to u/rws/doctests__even_reals_are_integers
comment:9 Changed 4 years ago by
 Commit set to 81e3fbabc4d05832f20d04ff216e112e607aa1d1
 Dependencies changed from pynac0.7.4 to #22219
 Milestone changed from sage7.5 to sage8.0
 Report Upstream changed from Fixed upstream, but not in a stable release. to N/A
 Status changed from new to needs_review
New commits:
81e3fba  22026: Doctest: Even reals are integer

comment:10 Changed 4 years ago by
 Reviewers set to Travis Scrimshaw
 Status changed from needs_review to positive_review
LGTM.
comment:11 Changed 4 years ago by
 Branch changed from u/rws/doctests__even_reals_are_integers to 81e3fbabc4d05832f20d04ff216e112e607aa1d1
 Resolution set to fixed
 Status changed from positive_review to closed
Note: See
TracTickets for help on using
tickets.
I wasn't sure if I should report this as a defect or as an enhancement.
I'll add that if one tries
an error is raised:
so "someone" knows
x
is an integer...