I've been stuck on this for a few days.
I'm supposed to find an example of a continuous function $f$ (with values in the field) defined on an affine variety $V=V_1\cup V_2$ with two irreducible components, such that the restrictions to each component is regular, but $f^n$ is not regular for all $n\geq1$.
This doesn't exist in one dimension, so I tried finding such an example by playing with plane curves that are tangent, and considered various functions on each component like the restrictions of projections on different coordinate axes. but I had no success, other than finding a function that is not regular, but it's square is regular, so it's not enough (like the one described by Georges).
A follow-up question that interests me, if those two components are disjoint, would it then have to be regular? (Answer: yes, see Georges comment)
what if they intersect in sufficiently nice ways, would the function have to be regular? I just don't know where to start looking, so some criteria might help.
if one can show it doesn't exist (i.e there always exists a power for which $f^n$ is regular) it is very welcome aswell.
– Feelix Mar 14 '17 at 18:04