Opened 5 years ago

Closed 4 years ago

# Doctests: Even reals are integers

Reported by: Owned by: pelegm major sage-8.0 symbolics is_integer, assume Ralf Stephan Travis Scrimshaw N/A 81e3fba 81e3fbabc4d05832f20d04ff216e112e607aa1d1 #22219

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
```

### comment:1 Changed 5 years ago by pelegm

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

### comment:2 Changed 5 years ago by rws

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

### comment:3 Changed 5 years ago by rws

• Report Upstream changed from N/A to Reported upstream. Developers acknowledge bug.

### comment:4 Changed 5 years ago by rws

• Dependencies set to pynac-0.7.4

### comment:5 Changed 5 years ago by rws

• Description modified (diff)
• Report Upstream changed from Reported upstream. Developers acknowledge bug. to Fixed upstream, but not in a stable release.

### comment:6 Changed 5 years ago by rws

• Description modified (diff)

Not fixed in Pynac, huh.

### comment:7 Changed 4 years ago by rws

• 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 rws

• Branch set to u/rws/doctests__even_reals_are_integers

### comment:9 Changed 4 years ago by rws

• Authors set to Ralf Stephan
• Commit set to 81e3fbabc4d05832f20d04ff216e112e607aa1d1
• Dependencies changed from pynac-0.7.4 to #22219
• Milestone changed from sage-7.5 to sage-8.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 tscrim

• Reviewers set to Travis Scrimshaw
• Status changed from needs_review to positive_review

LGTM.

### comment:11 Changed 4 years ago by vbraun

• 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.