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,838 of 10,432   
   Tom D to Nasser M. Abbasi   
   Re: how does your CAS handle this integr   
   04 Mar 18 11:59:57   
   
   From: tomdickens@att.net   
      
   This is what I get in Mathematica 11.2 on Windows:   
      
   In[37]:= $Version   
   Out[37]= 11.2.0 for Microsoft Windows (64-bit) (September 11, 2017)   
      
   In[39]:= Integrate[ Cos[n x] Sin[x]^2 Cos[x],  {x,0,2\[Pi]}]   
   Out[39]= -((2 n Sin[2 n \[Pi]])/(9-10 n^2+n^4))   
      
   (* See here why we get non-zero result at n=1,3 - roots of the denominator *)   
      
   In[40]:= Factor[%]   
   Out[40]= -((2 n Sin[2 n \[Pi]])/((-3+n) (-1+n) (1+n) (3+n)))   
      
   In[41]:= f[n_]:=Integrate[ Cos[n x] Sin[x]^2 Cos[x],  {x,0,2\[Pi]}]   
      
   In[43]:= Table[{n,f[n]},{n,0,8}]//TableForm   
      
   Out[43]//TableForm=   
   0  0   
   1  \[Pi]/4   
   2  0   
   3  -(\[Pi]/4)   
   4  0   
   5  0   
   6  0   
   7  0   
   8  0   
      
   I don't know why it is working for me ...   
      
   Regards,   
   Tom   
      
      
      
      
   On Friday, March 2, 2018 at 11:28:41 PM UTC-6, 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   
      
   --- 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