Computation of a minimal polynomial

In Sage you can do something like:

x=polygen(QQbar)
f=x^5 - x +1
roots = f.roots(QQbar)
a1 = roots[1][0]
a2 = roots[-1][0]
(a1 - a2).minpoly()
x^20 - 10*x^16 - 95*x^12 + 625*x^10 - 40*x^8 + 3750*x^6 + 400*x^4 + 5000*x^2 + 2869

Using resultants can greatly help. For example, knowing that $\sqrt[5]{2}$ is a zero of $P(x)=x^5-2$ and $1-\exp\frac{2\pi i}{5}$ is a zero of $Q(x)=(x-1)^5+1$, we conclude $\sqrt[5]{2}\cdot (1-\exp\frac{2\pi i}{5})$ is a zero of $\mathrm{Res}_y(P(y),y^5Q(\frac{x}{y}))$. In PARI/GP:

? polresultant(y^5-2,y^5*((x/y-1)^5+1),y)
%1 = x^25 + 2500*x^15 + 50000*x^5
? factor(%)
%2 = 
[                       x 5]

[x^20 + 2500*x^10 + 50000 1]

That is, we conclude that the minimal polynomial is $x^{20} + 2500x^{10} + 50000$. Numerical verification:

? subst(x^20 + 2500*x^10 + 50000, x, 2^(1/5)*(1-exp(2*Pi*I/5)) )
%3 = 5.380530270144733809 E-34 - 2.104034275277802617 E-34*I

(the default precision is 38 decimal digits)


To compute the minimal polynomial of integer multiple of an algebraic integer is easy, so the only thing you need for linear combinations is the minimal polynomials of sums. Now, note that if $A$ is the companion matrix of $\alpha$ and $B$ is the companion matrix of $\beta,$ then $A\otimes I + I\otimes B$ a companion matrix of $\alpha + \beta.$ (Of course, $A\otimes B$ is a companion matrix of $\alpha \beta.$)

Mathematica code:

frobeniusCompanion[poly_, x_] /; PolynomialQ[poly, x] := 
 Module[{n = Exponent[poly, x], coef}, 
  coef = CoefficientList[poly, x]; coef = -Most[coef]/Last[coef];
  SparseArray[{{1, j_} :> coef[[-j]], Band[{2, 1}] -> 1}, {n, n}]]


AA= frobeniusCompanion[x^5 -x -1, x]
CC = KroneckerProduct[AA, IdentityMatrix[5]] + KroneckerProduct[IdentityMatrix[5], AA]
 cp = CharacteristicPolynomial[Normal[CC], x]
 Factor[cp]

gives $$-\left(x^5-16 x-32\right) \left(x^{10}+3 x^6+11 x^5-4 x^2+4 x-1\right)^2$$