1 | initial version |
The following also works, although it might not be as flexible as the answer by @achrzesz, which handles things nicely.
x, y = var('x, y')
f(x,y)=x^2*y^2-4*x^2*y+2*y^2+4*x*y^4-3*x^4*y^6
g(x,y)=(f(x,y)+f(-x,y))/2
h(x,y)=(g(x,y)+g(x,-y))/2
h