x, y, r, phi = var('x y r phi') f(x, y) = sign(x^2 + y^2 - 4) T(r, phi) = [r*cos(phi), r*sin(phi)] J = diff(T).det().simplify_full() T_f = f.substitute(x=T[0], y=T[1]) int_f = integral(integral(T_f*abs(J), r, 0, 3), phi, 0, 2*pi).simplify_full () show(r"$\iint\limits_\Omega%s = %s$"%(latex(f(x)), latex(int_f))) Returns correct answer: $\pi$, while x, y, r, phi = var('x y r phi') f(x, y) = sign(x^2 + y^2 - 4) T(r, phi) = [r*cos(phi), r*sin(phi)] J = diff(T).det() #.simplify_full() T_f = f.substitute(x=T[0], y=T[1]) int_f = integral(integral(T_f*abs(J), r, 0, 3), phi, 0, 2*pi).simplify_full () show(r"$\iint\limits_\Omega%s = %s$"%(latex(f(x)), latex(int_f))) Yields $-9\pi$ The only thing simplify_full() changes here is it applies identity $\sin^2 + \cos^2 = 1$
Code was executed in SMC worksheet -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.