Define a polynomial subalgebra generated by given polynomials
Given a polynomial algebra in some variables, say $\mathbb{Q}[x_1,x_2,x_3,x_4]$, I'd like to define certain subalgebras that are generated by elements, e.g. $x_4$, $x_3^2-x_2x_4$. So I'd like to define $\mathbb{Q}[x_4,x_3^2-x_2x_4]$. As this uses the variables of the bigger space, I assume it needs to be defined as a subalgebra. But I could not seem to find a way of doing so.
I'm actually just interested in the dimensions of the degree-graded spaces of the subalgebra if that makes it easier.
Welcome to Ask Sage! Thank you for your question.
SageMath doesn't have subalgebra functionality conveniently exposed, but you can access some functionality from Singular. Related: Compute minimal number of generators of subring.