# Compute preimage of Ideals

It's me again. I am wondering how to compute the preimage of an ideal $J\subseteq B$ in a ring along a ring homomorphism $f\colon A\to B$. For simplicity I would be fine with assuming $A$ and $B$ are polynomial rings of finitely many variables over a field. As far as I know, preimages can then be computed algorithmically using Gröbner bases so I think this should be implemented in Sage. However I did not find such a possibility when browsing through the documentation. I hope you can help me (and maybe also point me to where such issues are documented). Thank you!

P.S.: The question of how to compute kernels of homorphisms of affine algebras over a field is of course equivalent.

It would be better if you start with concrete examples of

`A`

,`B`

and`f`

(ie Sage code to generate them).