Hi,
I've problem with this function. When I'm trying to use Your idea I see some errors (for example: unsupported operand parent(s) for '/'). I know that there should be definition of this convention (1/0=0). When I was trying to do this without this assumption I saw divided by zeros errors (it is understandable). Next think: there is 1/2 power and I'm not sure if it is correct defined in my example (example: x=a^2, y=a, y/x=a^2+1, and now (a^2+1)^(1/2)).
Your example is quite nice and I understand it and everything is OK when I'm trying simple examples using this argumentation.
I think that I should read more about SAGE, like You suggested, and then maybe it will be clearer, I hope.
Regards,
Arthur