Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2000
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2000

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Difficult integral

  • To: mathgroup at smc.vnet.net
  • Subject: [mg23464] Re: [mg23417] Difficult integral
  • From: Rolf Mertig <rolfm at xs4all.nl>
  • Date: Thu, 11 May 2000 00:54:14 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

The problem is that Mathematica's Factor is sometimes not optimal.
One possibility to do you Integral is to use linearity and some
fiddling (probably you can guess the general form quite easily).

In[1]:= $PrePrint=InputForm;

In[2]:= i[rho_]:=Map[Factor,(ExpandAll//@Numerator[#])/Denominator[#]]&[
        Together[Map[Function[z,Integrate[z,{x,0,2Pi}]],Expand[TrigToExp[
        Sin[x]^(2 rho) Exp[I n x] ] ] ]
        ]
        ]

In[3]:= i at 4

Out[3]= 
(-40320*I*(-1 + E^(I*n*Pi))*(1 + E^(I*n*Pi)))/((-8 + n)*(-6 + n)*(-4 + n)*
  (-2 + n)*n*(2 + n)*(4 + n)*(6 + n)*(8 + n))

In[4]:= i at 10 // Timing

Out[4]= 
{32.02*Second, (-2432902008176640000*I*(-1 + E^(I*n*Pi))*(1 + E^(I*n*Pi)))/
  ((-20 + n)*(-18 + n)*(-16 + n)*(-14 + n)*(-12 + n)*(-10 + n)*(-8 + n)*
   (-6 + n)*(-4 + n)*(-2 + n)*n*(2 + n)*(4 + n)*(6 + n)*(8 + n)*(10 + n)*
   (12 + n)*(14 + n)*(16 + n)*(18 + n)*(20 + n))}

In[5]:= Timing[i at 12]

Out[5]= 
{35.87*Second, (-620448401733239439360000*I*(-1 + E^(I*n*Pi))*
   (1 + E^(I*n*Pi)))/((-24 + n)*(-22 + n)*(-20 + n)*(-18 + n)*(-16 + n)*
   (-14 + n)*(-12 + n)*(-10 + n)*(-8 + n)*(-6 + n)*(-4 + n)*(-2 + n)*n*
   (2 + n)*(4 + n)*(6 + n)*(8 + n)*(10 + n)*(12 + n)*(14 + n)*(16 + n)*
   (18 + n)*(20 + n)*(22 + n)*(24 + n))}

In[6]:= Timing[i at 14]

Out[6]= 
{51.769999999999996*Second, (-304888344611713860501504000000*I*
   (-1 + E^(I*n*Pi))*(1 + E^(I*n*Pi)))/((-28 + n)*(-26 + n)*(-24 + n)*
   (-22 + n)*(-20 + n)*(-18 + n)*(-16 + n)*(-14 + n)*(-12 + n)*(-10 + n)*
   (-8 + n)*(-6 + n)*(-4 + n)*(-2 + n)*n*(2 + n)*(4 + n)*(6 + n)*(8 + n)*
   (10 + n)*(12 + n)*(14 + n)*(16 + n)*(18 + n)*(20 + n)*(22 + n)*(24 + n)*
   (26 + n)*(28 + n))}


- - -
Rolf Mertig
Mertig Research & Consulting
http://www.mertig.com


  • Prev by Date: Re: buggy part allocation ?
  • Next by Date: Re: Difficult integral: correction
  • Previous by thread: Re: Difficult integral
  • Next by thread: FrontEnd Questions