Hi All,
In Maxima (embedded in SageMath) you can use:
expand(trigrat(integrate(integrate(sin(x^2),x,y,1),y,0,1)));

in order to get exactly the same result in both cases.
Daniel


    En miércoles, 8 de diciembre de 2021 23:02:00 GMT+2, Fernando Q. Gouvea 
<fqgou...@colby.edu> escribió:  
 
  
I see. So the difference between this and, say, 1+1==2 (which returns True) is 
that 1+1 and 2 are numbers, not symbolic things.
 
Fernando
 
 On 12/8/2021 3:37 PM, William Stein wrote:
  
 
 
  
  On Wed, Dec 8, 2021 at 12:22 PM Fernando Q. Gouvea <fqgou...@colby.edu> wrote:
  
  
Thank you, that works. What is strange is that this does not:
 sage: right=integrate(integrate(sin(x^2),y,0,x),x,0,1)
sage: wrong=integrate(integrate(sin(x^2),x,y,1),y,0,1)
sage: real(wrong)==right
-1/2*cos(1) + 1/2 == -1/2*cos(1) + 1/2 
Is Sage seeing a difference there that I don't? 
  
 
  
 
 
 
I think I don't understand the difference between real(wrong)==right and 
bool(real(wrong)==right).
  
 In Sage "[symbol thing] == [symbolic thing]" is a constructor for a symbolic 
equation. 
  sage: SR(2) == SR(2) 2 == 2  sage: parent(SR(2) == SR(2)) Symbolic Ring sage: 
bool(SR(2) == SR(2)) True # only because Sage can *prove* they are equal -- 
it's false if it can't prove they are equal, even if they are equal... 
  
  https://cocalc.com/wstein/support/gouvea-equals
  
  
    
  
Fernando
 
 On 12/8/2021 1:23 PM, William Stein wrote:
  
 You can compare the real and imaginary parts directly. 
  https://cocalc.com/wstein/support/2021-12-08-gouvea
  
  sage: bool(wrong.real() == right) True sage: wrong.imag() 0  
  On Wed, Dec 8, 2021 at 10:07 AM Fernando Q. Gouvea <fqgou...@colby.edu> wrote:
  
  
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
 sage: integrate(integrate(sin(x^2),y,0,x),x,0,1) -1/2*cos(1) + 1/2 
The "wrong" way is
 sage: integrate(integrate(sin(x^2),x,y,1),y,0,1)

-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) 
Is there any way to get Sage to check that these are equal? 
 
 
The obvious thing does not seem to work:
 sage: -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

-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
 
Thanks,
 
Fernando
 
 -- 
==================================================================
Fernando Q. Gouvea                
Carter Professor of Mathematics  
Colby College                    
Mayflower Hill 5836        
Waterville, ME 04901       
fqgou...@colby.edu         http://www.colby.edu/~fqgouvea

I have had a perfectly wonderful evening, but this wasn't it.
  --Groucho Marx

  -- 
 You received this message because you are subscribed to the Google Groups 
"sage-support" group.
 To unsubscribe from this group and stop receiving emails from it, send an 
email to sage-support+unsubscr...@googlegroups.com.
 To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/9557c1a9-bd1c-69e1-358f-4ab02a058c3a%40colby.edu.
 
  
 
  -- 
 William (http://wstein.org) -- 
 You received this message because you are subscribed to the Google Groups 
"sage-support" group.
 To unsubscribe from this group and stop receiving emails from it, send an 
email to sage-support+unsubscr...@googlegroups.com.
 To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CACLE5GC6SNZuSsJ13iRFbO72Udn80Yy5OavR1SFwv03gjaQxvw%40mail.gmail.com.
 
 -- 
==================================================================
Fernando Q. Gouvea                
Carter Professor of Mathematics  
Colby College                    
Mayflower Hill 5836        
Waterville, ME 04901       
fqgou...@colby.edu         http://www.colby.edu/~fqgouvea

What is socialism?

The painful transition from capitalism to capitalism.

  -- 
 You received this message because you are subscribed to the Google Groups 
"sage-support" group.
 To unsubscribe from this group and stop receiving emails from it, send an 
email to sage-support+unsubscr...@googlegroups.com.
 To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/5ea4d847-d5a5-1053-cc98-e071382cf49f%40colby.edu.
 
  
 
  -- 
 William (http://wstein.org)  -- 
 You received this message because you are subscribed to the Google Groups 
"sage-support" group.
 To unsubscribe from this group and stop receiving emails from it, send an 
email to sage-support+unsubscr...@googlegroups.com.
 To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CACLE5GCjm_qE-ufEiOWQ%3DxLsFVsV_Nm6hKdygv121Ss2Tf_iGg%40mail.gmail.com.
 -- 
==================================================================
Fernando Q. Gouvea                
Carter Professor of Mathematics  
Colby College                    
Mayflower Hill 5836        
Waterville, ME 04901       
fqgou...@colby.edu         http://www.colby.edu/~fqgouvea

Being powerful is like being a lady. If you have to tell people you
are, you aren't.
  -- Margaret Thatcher

 

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/b79f24fb-bc12-894b-bfe7-10c95edc81a2%40colby.edu.
  

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/471639076.249648.1639042583967%40mail.yahoo.com.

Reply via email to