Here's an example of what I'm trying to do:
I have an elliptic curve $E : y^2 = x^3+x$ over the field $F= GF(43)$. I want to be able to go back and forth between $F(E)$ and $F(x,y)$ in MAGMA.
This is because I have rational functions, $p(x,y)/q(x,y)$, but I want to be able to write the high powers of $y$ as linear functions in $y$ with coefficients in $x$ using the equation for $E$. So, I coerce an expression into the function field of $E$. I have a very messy and ad hoc way of doing it but I'd like to know the "proper way". Here's an example
> F:=GF(43);
> R<X>:=PolynomialRing(F);
> E:=EllipticCurve([F!1,F!0]);
> E1,p:=IsogenyFromKernel(E,X);
> S<z,w>:= Parent(IsogenyMapOmega(p));
> omega:=IsogenyMapOmega(p);
> phi:=Evaluate(IsogenyMapPhi(p),z);
> psi := Evaluate(IsogenyMapPsi(p),z);
> SS<a,b>:=FieldOfFractions(S);
> KE<x,y>:=FunctionField(E);
> omega^2/psi;
(a^4*b^2 + 41*a^2*b^2 + b^2)/a
I want to take the $b^2$ and substitute $a^3+a$. So I try
> KE!omega^2/psi
but MAGMA says its an illegal coercion.
I also want to be able to do substitutions on these expressions, so I need to coerce back to $F(x,y)$, but MAGMA says such a coercion is illegal
You can just define a homomorphism $\varphi: F(u,v) \to F(E)$.
This returns
x^6 + 42*x^4 + 42*x^2 + 1.You can define a lifting map in the other direction that will be a right inverse, but, as you point out in the comments, will not be a homomorphism:
This returns
u^2 + 40*u*v^2 + v^4 + 1.Here's a hacky way to get the rational function back represented in the same way as it was in the function field of $E$.
With $f = v^{43}$ and $g = \varphi(f)$ as in your example, this returns