home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   sci.math.symbolic      Symbolic algebra discussion      10,432 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 9,835 of 10,432   
   Nasser M. Abbasi to acer   
   Re: how does your CAS handle this integr   
   03 Mar 18 01:00:56   
   
   From: nma@12000.org   
      
   On 3/3/2018 12:32 AM, acer wrote:   
   > On Saturday, March 3, 2018 at 12:28:41 AM UTC-5, Nasser M. Abbasi wrote:   
   >> so far, Maple 2017.3 and Mathematica 11.2 give wrong results   
   >> on this:   
   >>   
   >> integrand := cos(x)* sin(x)^2*cos(n*x);   
   >>   
   >> Now I wanted to integrate the above from 0..2PI   
   >> with the assumption that n above is integer and   
   >> positive.   
   >>   
   >> What does your CAS give for the integral?  hint:   
   >> it should not be zero.  But....   
   >>   
   >> Maple:   
   >> integrand := cos(x)* sin(x)^2*cos(n*x);   
   >> assume(n,integer,n>0);   
   >> int(integrand,x=0..2*Pi);   
   >>   
   >>              0   
   >>   
   >> Mathematica:   
   >> Assuming[Element[n, Integers] && n > 0,   
   >>               Integrate[integrand, {x, 0, 2 Pi}]]   
   >>       0   
   >>   
   >> But this integral is not zero for all integer n.   
   >>   
   >> Table[Integrate[integrand, {x, 0, 2 Pi}], {n, 1, 5}]   
   >>           {Pi/4,0,-Pi/4,0,0}   
   >>   
   >> I do not know how to use assumptions yet in Fricas   
   >> to test this. Will try to learn how to.   
   >>   
   >> I really do not understand how advanced and mature CAS   
   >> systems like Maple and Mathematica can get this wrong.   
   >>   
   >> Or may be it is by design. I do not know. Someone told   
   >> me it is hard to program these exception cases into CAS   
   >> and have it check for each special case.  Any thoughts?   
   >>   
   >> --Nasser   
   >   
   >   
   > kernelopts(version);   
   >     Maple 2017.2, X86 64 LINUX, Jul 19 2017, Build ID 1247392   
   >   
   > restart;   
   > integrand := cos(x)* sin(x)^2*cos(n*x):   
   > assume(n,integer,n>0);   
   > int(integrand,x=0..2*Pi,allsolutions);   
   >   
   >                       /  1   
   >                       |  - Pi         n = 1   
   >                       |  4   
   >                       |   
   >                      <    1   
   >                       | - - Pi        n = 3   
   >                       |   4   
   >                       |   
   >                       \   0         otherwise   
   >   
   > restart;   
   > integrand := cos(x)* sin(x)^2*cos(n*x):   
   > int(integrand,x=0..2*Pi,allsolutions) assuming n::integer, n>0;   
   >   
   >                       /  1   
   >                       |  - Pi         n = 1   
   >                       |  4   
   >                       |   
   >                      <    1   
   >                       | - - Pi        n = 3   
   >                       |   4   
   >                       |   
   >                       \   0         otherwise   
   >   
   >   
   >   
      
   Ah!, so a user in Maple has to use the option "allsolutions" to   
   obtain the correct solution!  At least Maple does have   
   such option, which is nice.   
      
   The question is, should CAS give the above result by default   
   or not.  Maybe this is a design issue. I think   
   the above result should be the default.   
      
   But at least my faith was a litte restored now with CAS :)   
      
   Reason I asked, is becuase I was using the zero result,   
   among others, to verify some other result which then made   
   no sense.   
      
   I trusted CAS result, and was too lazy to check each   
   calculation (if one has to double check each CAS result   
   by hand, then why use CAS?)   
      
   Thanks,   
   --Nasser   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca