Opened 10 years ago

Closed 10 years ago

# evaluating multivariate polynomials yields non-constant

Reported by: Owned by: cremona AlexGhitza major sage-4.4 algebra polynomial evaluation wuthrich, malb sage-4.4.alpha0 John Cremona Alex Ghitza N/A

### Description

The following behaviour does not agree with the documentation for the {{{call}} function on multivariable polynomials, which states that (as one would expect and hope) the result should lie in the constant field:

```sage: K.<t> = NumberField(x^2+47)
sage: R.<X,Y,Z> = K[]
sage: f = X+Y+Z
sage: a = f(t,t,t)
sage: a.parent()
Multivariate Polynomial Ring in X, Y, Z over Number Field in t with defining polynomial x^2 + 47
```

It is also inconsistent:

```sage: R.<X,Y,Z> = QQ[]
sage: f = X+Y+Z
sage: a = f(2,3,4)
sage: a.parent()
Rational Field
```

This causes strange bugs -- see #8498 for an example.

### comment:1 Changed 10 years ago by cremona

• Authors set to John Cremona

Bug fixed: I added tests for when the resulting value is either 0, or a nonzero constant, in which case an element of the base ring is returned. Otherwise an element of the parent is returned (so you can still evaluate f(x+y,y) and similar.)

Patch up as soon as testing is finished.

malb: I'm CC-ing you as the past person to work on this file.

Applies to 4.3.5

### comment:2 Changed 10 years ago by cremona

• Status changed from new to needs_review

### comment:3 Changed 10 years ago by AlexGhitza

• Reviewers set to Alex Ghitza
• Status changed from needs_review to positive_review

Looks good.

### comment:4 Changed 10 years ago by jhpalmieri

• Merged in set to sage-4.4.alpha0
• Resolution set to fixed
• Status changed from positive_review to closed

Merged "trac_8502-mpoly.patch" in 4.4.alpha0.

Note: See TracTickets for help on using tickets.