1 | initial version |

If you add some debugging print, you will notice that `arent(aux)`

is first `Univariate Polynomial Ring in x over Integer Ring`

but then `Univariate Polynomial Ring in x over Rational Field`

, because you made a division, and though the resulting coefficient remain integers, they now belong to the rational field, see:

```
sage: parent(2)
Integer Ring
sage: 4/2
2
sage: parent(4/2)
Rational Field
```

So what you have to do is to convert the result back into `ZX`

:

```
sage: primitive_part = lambda f : ZX(f / f.content())
```

Or, since `ZX`

is the parent of `f`

, you can do more generically:

```
sage: primitive_part = lambda f : parent(f)(f / f.content())
```

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.