Message Boards Message Boards

0
|
4740 Views
|
10 Replies
|
5 Total Likes
View groups...
Share
Share this post:

Integrate a transcendental function given by a power series?

Anonymous User
Anonymous User
Posted 5 years ago

Is it possible to integrate a transcendental function given by a power series sum, instead of summing up the individual integrals in the power series? Reason why I'm asking this is cause each individual integral takes too long to calculate, so if I need to sum say 50 terms it will take forever, so if Mathematica has a way to define a function by means of a power series, however complicated it may get and then calculate its integral over say 0 and 1, that'd be ideal.

Let me give an example below:

The example is such that summing up 50 terms of this series would require calculating 50 integrals which are really slow to calculate, so I think there must be a better way to do that.

Let me know if you'd like to me to paste the plain Mathematica code in here, I'm new to this site so I don't know very well how to do that.

M = 10; n = 2; m = 1; 
  N[(1/4)*
  Sum[(I*2*Pi*n)^k*Sum[(((-2)^(k-p)*(m*p)^(k+1))/(p!*(k-p)!*k!))* 
  Integrate[(1-u)^k*Coth[(m*p*u)/2]*(E^(m*p*n*u)-1), {u,0,1}], {p,1, k}], {k,1,M}], 5]

enter image description here

Btw, how do I copy and paste here from a notebook without having to replace Mathematica's graphic symbols with plain commands?

POSTED BY: Anonymous User
10 Replies
Anonymous User
Anonymous User
Posted 5 years ago

I think you won't be able to simplify that long formula further. I even posted a post on math.stackexchange asking if somebody knows how to simplify it. Besides, I know the Simplify formula in Mathematica, it just doesn't work for these sums.

The link is below: Post on MSE

POSTED BY: Anonymous User

I hate it when formulas get that messy.(Sometimes they have to, but by being clever, we can, sometimes, simplify them a little. There are even ways of making Mathematica simplify it.) Let me see if I can come up with a less complicated one. Where did the formula that you said diverges at infinity come from?

POSTED BY: Marvin Ray Burns

Is this actually the formula you wan't an answer too? enter image description here Look at it carefully before we decide to work on it.

POSTED BY: Marvin Ray Burns
Anonymous User
Anonymous User
Posted 5 years ago

Let me check and I'll get back to you. Hang on. Thanks a lot btw

POSTED BY: Anonymous User
Anonymous User
Anonymous User
Posted 5 years ago

Let me give you a little background first. The formula I'm trying to calculate is below: enter image description here

Note it converges if M is finite, but not infinite. But then, below I have a formula which gives an analytic continuation for the infinite sum over $n$ which converges even if $m>0$ (if $m<0$ both the left and the right-hand sides converge and they match, if $m>0$ only the right-hand side converges -- note that below $M=\infty$): enter image description here

Now, to make things simpler, let's try to sum up everything together for a large M2. Let's ignore the complex part, because for positive $m$ only the last term is complex. I could've used better variable names, but darn Mathematica made N a reserved keyword.

Hence altogether the sum I need to calculate is this little monster:enter image description here

And the input formula is:

M2 = 100; m = Log[2]; 
  N[Sum[(-1)^k*(2*Pi)^(2*k)*(2*k)!*
   Sum[(BernoulliB[2*j]/((2*k + 1 - 2*j)!*(2*j)!))*

     Sum[((-2)^(2*k - 
            p)/(p!*(2*k - p)!))*((-(1/
              2))*((m*p)^(2*j + 2)/(2*j + 2)!) - ((m*p)^(2*j + 
               1)/(2*j + 1)!)*Log[(m*p)/(2*Pi)] + 

         Sum[((m*p)^(2*j + 2 - i)*Zeta[i])/(2*j + 2 - i)!, {i, 2, 
           2*j + 2}] - (1/2)*((m*p)^(2*j + 2)/(2*j + 1)!)*

          Integrate[(1 - u)^(2*j + 1)*
             Coth[(m*p*u)/2] - ((2*Pi)/(m*p))*(1 - u)*Cot[Pi*u], {u, 
            0, 1}]), {p, 1, 2*k}], {j, 0, k}], {k, 1, M2}], 10]
POSTED BY: Anonymous User

Cell, convert to,input form and copy.

 M = 10; n = 2; m = 1; 
  N[(1/4)*
  Sum[(I*2*Pi*n)^k*Sum[(((-2)^(k - p)*(m*p)^(k + 1))/(p!*(k - p)!*k!))*

      Integrate[(1 - u)^k*Coth[(m*p*u)/2]*(E^(m*p*n*u) - 1), {u, 0, 
        1}], {p, 1, k}], {k, 1, M}], 5]

Have you tried?

   M = 10; n = 2; m = 1; 
  (1/4)*Sum[(I*2*Pi*n)^k*
   Sum[(((-2)^(k - p)*(m*p)^(k + 1))/(p!*(k - p)!*k!))*

     NIntegrate[(1 - u)^k*Coth[(m*p*u)/2]*(E^(m*p*n*u) - 1), {u, 0, 
       1}, WorkingPrecision -> 20], {p, 1, k}], {k, 1, M}]

 (*-6.2667948461439727*10^7 + 1.89297162946885025*10^7 I*)
POSTED BY: Marvin Ray Burns
Anonymous User
Anonymous User
Posted 5 years ago

Not yet, I will try this, it should be just what I need. Thank you so much, you're the best :)

Edit: Yes, it runs faster.

Btw, for my learning, what in your code is different from the formula in the picture that makes it run faster?

POSTED BY: Anonymous User

NSum uses floating point arithmetic, so it doesn't have to worry about the algebra!

I think the code can be sped up even more!

Mathematica is really very fast, if you use it right. See how much I sped up the MRB constant record computations !!!!

POSTED BY: Marvin Ray Burns
Anonymous User
Anonymous User
Posted 5 years ago

Amazing, that is the best. If I'm able to finish my work successfully I will let you know so you can have a look (no more hassle for you, just for your curiosity).

POSTED BY: Anonymous User
Anonymous User
Anonymous User
Posted 5 years ago

Hey Marvin, the below is the actual sum that I need to calculate.

I see two problems with this approach.

  • It's still not fast enough
  • it's not giving me a very precise result as when I use say N[*,10], E.g., it displays the result as 0. * 10^11 (no decimal places)

Do you think you might be able to optimize this more and make the result more precise?

M = 100; m = Log[2]; N[
 x5 = Sum[(-1)^k*(2*Pi)^(2*k)*(2*k)!*
    Sum[(BernoulliB[2*j]/((2*k + 1 - 2*j)!*(2*j)!))*

      Sum[((-2)^(2*k - 
             p)/(p!*(2*k - p)!))*((-(1/
               2))*((m*p)^(2*j + 2)/(2*j + 2)!) - 
                     ((m*p)^(2*j + 1)/(2*j + 1)!)*Log[(m*p)/(2*Pi)] + 
          Sum[((m*p)^(2*j + 2 - i)*Zeta[i])/
                         (2*j + 2 - i)!, {i, 2, 
            2*j + 2}] - (1/2)*((m*p)^(2*j + 2)/(2*j + 1)!)*

           Integrate[(1 - u)^(2*j + 1)*
              Coth[(m*p*u)/2] - ((2*Pi)/(m*p))*(1 - u)*Cot[Pi*u], {u, 
             0, 1}]), 
                {p, 1, 2*k}], {j, 0, k}], {k, 1, M}], 10]
POSTED BY: Anonymous User
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract