A theorem of Stafford says that every ideal in the Weyl algebra can be generated by 2 elements. This routine is the implementation of the effective version of this theorem following the constructive proof in A.Leykin, `Algorithmic proofs of two theorems of Stafford', Journal of Symbolic Computation, 38(6):15351550, 2004.
The current implementation provides a weaker result: the 2 generators produced are guaranteed to generate only the extension of the ideal I in the Weyl algebra with rationalfunction coefficients.


The input should be generated by at least 2 generators. The output and input ideals are not equal necessarily.
The object stafford is a method function.