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

Doctests: Even reals are integers #22026

Closed
pelegm opened this issue Dec 6, 2016 · 19 comments
Closed

Doctests: Even reals are integers #22026

pelegm opened this issue Dec 6, 2016 · 19 comments

Comments

@pelegm
Copy link
Contributor

pelegm commented Dec 6, 2016

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 pynac-0.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

Depends on #22219

Component: symbolics

Keywords: is_integer, assume

Author: Ralf Stephan

Branch/Commit: 81e3fba

Reviewer: Travis Scrimshaw

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

@pelegm pelegm added this to the sage-7.5 milestone Dec 6, 2016
@pelegm
Copy link
Contributor Author

pelegm commented Dec 6, 2016

comment:1

I wasn't sure if I should report this as a defect or as an enhancement.

I'll add that if one tries

sage: assume(x, 'noninteger')

an error is raised:

Traceback (most recent call last):
...
ValueError: Assumption is inconsistent

so "someone" knows x is an integer...

@rwst
Copy link

rwst commented Dec 6, 2016

comment:2

Yes, Maxima knows. The inference logic however is in Pynac.

@rwst
Copy link

rwst commented Jan 14, 2017

Upstream: Reported upstream. Developers acknowledge bug.

@rwst
Copy link

rwst commented Jan 14, 2017

comment:3

This is now pynac/pynac#225

@rwst
Copy link

rwst commented Jan 17, 2017

Dependencies: pynac-0.7.4

@rwst

This comment has been minimized.

@rwst
Copy link

rwst commented Jan 17, 2017

Changed upstream from Reported upstream. Developers acknowledge bug. to Fixed upstream, but not in a stable release.

@rwst
Copy link

rwst commented Feb 8, 2017

comment:6

Not fixed in Pynac, huh.

@rwst

This comment has been minimized.

@rwst
Copy link

rwst commented Jun 3, 2017

comment:7

Issue is fixed. Only doctests needed.

@rwst rwst changed the title Even reals are integers Doctests: Even reals are integers Jun 3, 2017
@rwst
Copy link

rwst commented Jun 5, 2017

@rwst
Copy link

rwst commented Jun 5, 2017

Author: Ralf Stephan

@rwst
Copy link

rwst commented Jun 5, 2017

Commit: 81e3fba

@rwst
Copy link

rwst commented Jun 5, 2017

New commits:

81e3fba22026: Doctest: Even reals are integer

@rwst
Copy link

rwst commented Jun 5, 2017

Changed dependencies from pynac-0.7.4 to #22219

@rwst
Copy link

rwst commented Jun 5, 2017

Changed upstream from Fixed upstream, but not in a stable release. to none

@rwst rwst modified the milestones: sage-7.5, sage-8.0 Jun 5, 2017
@tscrim
Copy link
Collaborator

tscrim commented Jun 5, 2017

Reviewer: Travis Scrimshaw

@tscrim
Copy link
Collaborator

tscrim commented Jun 5, 2017

comment:10

LGTM.

@vbraun
Copy link
Member

vbraun commented Jun 7, 2017

Changed branch from u/rws/doctests__even_reals_are_integers to 81e3fba

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