Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Views: 57
Image: ubuntu2004-dev
Kernel: SageMath 9.4

I was showing my students a famous calculus example of an integral that can be computed in one order of the variables but not in the other. Knowing that SageMath can compute anything, the students suggested trying the integral the "wrong" way. The "right" way is

var('x,y') right = integrate(integrate(sin(x^2),y,0,x),x,0,1); right
-1/2*cos(1) + 1/2

The "wrong" way is

wrong = integrate(integrate(sin(x^2),x,y,1),y,0,1); wrong
-1/16*(-1)^(3/4)*((sqrt(2) + 4*(-1)^(1/4))*e^I - sqrt(-I)*((I + 1)*sqrt(2)*(-1)^(1/4)*e^(2*I) - (I + 1)*sqrt(2)*(-1)^(1/4)*e^I) + I*sqrt(2)*e^I - 2*(-1)^(1/4)*e^(2*I) - (I + 1)*sqrt(2) - 2*(-1)^(1/4))*e^(-I)
wrong == right
-1/16*(-1)^(3/4)*((sqrt(2) + 4*(-1)^(1/4))*e^I - sqrt(-I)*((I + 1)*sqrt(2)*(-1)^(1/4)*e^(2*I) - (I + 1)*sqrt(2)*(-1)^(1/4)*e^I) + I*sqrt(2)*e^I - 2*(-1)^(1/4)*e^(2*I) - (I + 1)*sqrt(2) - 2*(-1)^(1/4))*e^(-I) == -1/2*cos(1) + 1/2
# In Sage this means that sage couldn't prove they are equal bool(wrong==right)
False
CC(wrong)
0.229848847065930 - 4.16333634234434e-17*I
CC(right)
0.229848847065930
bool(wrong.real() == right)
True
wrong.imag()
0