Loading [MathJax]/jax/output/HTML-CSS/jax.js

First time here? Check out the FAQ!

Ask Your Question
1

Problem with infinite sum

asked 12 years ago

petropolis gravatar image

updated 12 years ago

With Maple everything is so simple.

R := n -> sum(bernoulli(2*k)/n^(2*k), k = 1..infinity);
seq(evalf(R(i)), i = 1..5);
0.1449340668,0.03986813370,...

With Sage that's another story.

def R(n):
    var('k')
    return sum(bernoulli(2*k)/n^(2*k), k, 1, infinity)

[R(i) for i in (1..5)]

TypeError: unable to convert x (=2*k) to an integer. What do I miss?

EDIT with errors deleted.

Preview: (hide)

Comments

Yes, you suggested import mpmath. Because of the effects you describe I always work with different worksheets, one with mpmath and one without. Of course this is peripheral here with regard to the problem.

petropolis gravatar imagepetropolis ( 12 years ago )

Yes, I swapped n and k. Sorry for this. I deleted the edit.

petropolis gravatar imagepetropolis ( 12 years ago )

1 Answer

Sort by » oldest newest most voted
2

answered 12 years ago

kcrisman gravatar image

bernoulli is not a "symbolic function" in Sage, so it can't accept inputs that aren't integers like 2*k. We are working on converting many previously only numerical functions in Sage to accept symbolic input (like Bessel functions), but probably the first priority of number theorists in Sage wasn't to allow that particular functionality for Bernoulli numbers. Even if clever power series tricks can allow summations of such things.

So I don't think you can directly do the sum from 1 to infinity this way. However, the magic of lambda functions might make things nearly as good? I don't know what you are looking for exactly.

sage: F = lambda k,n: bernoulli(2*k)/n^(2*k)

But some experimentation suggests that if e.g. the sum for n=1 really does converge to -1/4/(e - e^(3/2)), it must do so VERY slowly, so probably you would only be interested in the symbolic solution, which Maxima doesn't seem to have either.

Preview: (hide)
link

Comments

1

We should really start leveraging more of `mpmath` and `sympy`. As a workaround for the numerics, `import mpmath; R = lambda n: mpmath.nsum(lambda k: mpmath.bernoulli(2*k)/n**(2*k), [1, mpmath.inf])` should work. BTW, you've almost hit 6k!!

DSM gravatar imageDSM ( 12 years ago )
1

@kcrisman Both types of solutions would be nice, of course. Thank you, I will help you to get the 6k for the case n=1 ;-)) @DSM mpmath is nice and even faster than Maple. Thank you. Write it as an answer and I will help you to reach the 5k. (By the way I soon will reach 100, nobody noticed this? :-)

petropolis gravatar imagepetropolis ( 12 years ago )

The series certainly doesn't converge for n=1, since abs(bernoulli(2*k)) tends to infinity as k tends to infinity. In fact I don't believe that the series converges for any integral value of n, for I think sumk=1B2kx2k has zero radius of convergence. This should follow from knowing that sumk=1B2kx2k/(2k)! has radius of convergence 2π; the value is x/(ex1)1x/2.

Francis Clarke gravatar imageFrancis Clarke ( 12 years ago )

@Francis Clarke "The series certainly doesn't converge for n=1, since abs(bernoulli(2k)) tends to infinity as k tends to infinity." Hmmm, abs((-1)^k(k+1/k)) tends to infinity as k tends to infinity but sum((-1)^k(k+1/k)/n^k,k=1..infinity) converges, for n>1, if I am not mistaken.

petropolis gravatar imagepetropolis ( 12 years ago )

The remark that |B2k| was intended only to justify divergence for n=1. The final sentence implies divergence for n>1.

Francis Clarke gravatar imageFrancis Clarke ( 12 years ago )

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 12 years ago

Seen: 1,852 times

Last updated: Dec 30 '12