Add support for function fields in minpoly

```minpoly``` now additionally works with algebraic functions.
```
In [1]: minpoly(sqrt(x), y)
Out[1]: 
      2
-x + y

In [2]: minpoly(sqrt(x) / z, y)
Out[2]: 
      2  2
-x + y ⋅z
```
This replaces my PR #2100.