A Gröbner basis criterion for birational equivalence of affine varieties Conjugacy classes of affine automorphisms of \(\mathbb K^n\) and linear automorphisms of \(\mathbb P^n\) in the Cremona groups 