wrong or nonexistent results for various infinite sums

53 views
Skip to first unread message

Karl S

unread,
Apr 23, 2014, 5:40:46 PM4/23/14
to sage-s...@googlegroups.com
I am working on several problems that involve infinite sums, and the expressions can get quite complicated. Sage can solve some of these, such as

m,p = var('m,p')

#taylor coefficient for erf(3x)
a_erf
(m) = (3)^(2*m+1)*(-1)^m*2/sqrt(pi)/(factorial(m)*(2*m+1))

#coefficient of chebyshev polynomial
c_erf_cheb
(p) = sum(a_erf(m)*binomial(2*m+1,m-p)*4^-m,m,p,oo).simplify_full()

Here the function c_erf_cheb(p) ends up being
-6/11*(bessel_I(6, -9/2) - bessel_I(5, -9/2))*sqrt(e)*e^(-5)/sqrt(pi)

which, to me, is a very useful answer. But other sums are simply wrong.

k = var('k')
sum
(x^(2*k)/factorial(2*k),k,0,oo)

gives

-1/4*sqrt(2)*sqrt(pi)*x^(3/2)

but the answer should be sinh(x). For other sums, Sage simply repeats what I told it.

sum(x^(3*k)/factorial(2*k),k,0,oo)

I understand that Sage has limited exploitation of Maxima's hypergeometric functionality, and I suspect this is the main issue. Are there any conceivable workarounds?

kcrisman

unread,
Apr 23, 2014, 9:38:08 PM4/23/14
to sage-s...@googlegroups.com
But other sums are simply wrong.

k = var('k')
sum
(x^(2*k)/factorial(2*k),k,0,oo)

gives

-1/4*sqrt(2)*sqrt(pi)*x^(3/2)

but the answer should be sinh(x).

Hmm.  That shouldn't be happening, though I wouldn't be surprised if it didn't turn out as easy as that.

(%i1) load(simplify_sum);
urces/sage/local/share/maxima/5.29.1/share/solve_rec/simplify_sum.mac
(%i3) display2d:false;

(%o3) false
(%i4) simplify_sum(sum(x^(2*k)/factorial(2*k),k,0,inf));

(%o4) sqrt(%pi)*bessel_i(-1/2,x)*sqrt(x)/sqrt(2)

So I'm not sure why that would happen - maybe because of incorrect Bessel simplification?

sage: maxima_calculus('bessel_i(-1/2,x)')
bessel_i(-1/2,x)
sage: _._sage_()
sqrt(2)*sqrt(1/(pi*x))*cosh(x)

That gives cosh(x), which I think is what you meant.  This is now tracked at http://trac.sagemath.org/ticket/16224.

 
For other sums, Sage simply repeats what I told it.

sum(x^(3*k)/factorial(2*k),k,0,oo)

I understand that Sage has limited exploitation of Maxima's hypergeometric functionality, and I suspect this is the main issue. Are there any conceivable workarounds?

Yeah, that is definitely part of it.  See e.g http://trac.sagemath.org/ticket/9908 .

- kcrisman

Nils Bruin

unread,
Apr 23, 2014, 10:30:43 PM4/23/14
to sage-s...@googlegroups.com
On Wednesday, April 23, 2014 2:40:46 PM UTC-7, Karl S wrote:

I understand that Sage has limited exploitation of Maxima's hypergeometric functionality, and I suspect this is the main issue. Are there any conceivable workarounds?

 http://trac.sagemath.org/ticket/2516 should basically do the trick for hypergeometric functions. It's ready to be reviewed.

Robert Dodier

unread,
Apr 23, 2014, 11:52:24 PM4/23/14
to sage-s...@googlegroups.com
On 2014-04-23, Karl S <art.l...@gmail.com> wrote:

> #taylor coefficient for erf(3x)
> a_erf(m) = (3)^(2*m+1)*(-1)^m*2/sqrt(pi)/(factorial(m)*(2*m+1))
>
> #coefficient of chebyshev polynomial
> c_erf_cheb(p) = sum(a_erf(m)*binomial(2*m+1,m-p)*4^-m,m,p,oo).simplify_full
> ()
>
> Here the function c_erf_cheb(p) ends up being
>
> -6/11*(bessel_I(6, -9/2) - bessel_I(5, -9/2))*sqrt(e)*e^(-5)/sqrt(pi)

Hmm, what is p in that result? For small values of p I get something
similar but not the same.

> which, to me, is a very useful answer. But other sums are simply wrong.
>
> k = var('k')
> sum(x^(2*k)/factorial(2*k),k,0,oo)

I'm working with Maxima 5.33.0. I get

simplify_sum ('sum(x^(2*k)/factorial(2*k),k,0,inf));
=> sqrt(%pi)*bessel_i(-1/2,x)*sqrt(x)/sqrt(2)

which seems to be cosh(x).

> sum(x^(3*k)/factorial(2*k),k,0,oo)

I get

simplify_sum ('sum(x^(3*k)/factorial(2*k),k,0,inf));
=> sqrt(%pi)*bessel_i(-1/2,x^(3/2))*x^(3/4)/sqrt(2)

Hope this helps,

Robert Dodier

kcrisman

unread,
Apr 24, 2014, 11:13:40 AM4/24/14
to sage-s...@googlegroups.com

> which, to me, is a very useful answer. But other sums are simply wrong.
>
> k = var('k')
> sum(x^(2*k)/factorial(2*k),k,0,oo)

I'm working with Maxima 5.33.0. I get

  simplify_sum ('sum(x^(2*k)/factorial(2*k),k,0,inf));
    => sqrt(%pi)*bessel_i(-1/2,x)*sqrt(x)/sqrt(2)

which seems to be cosh(x).

> sum(x^(3*k)/factorial(2*k),k,0,oo)

I get

  simplify_sum ('sum(x^(3*k)/factorial(2*k),k,0,inf));
    => sqrt(%pi)*bessel_i(-1/2,x^(3/2))*x^(3/4)/sqrt(2)

Yes, at the ticket in question Nils was able to diagnose it as what I suspected, an incorrect translation from Maxima to Sage.  Thanks! 

kcrisman

unread,
Jul 8, 2014, 12:17:33 PM7/8/14
to sage-s...@googlegroups.com

sum(x^(3*k)/factorial(2*k),k,0,oo)

I understand that Sage has limited exploitation of Maxima's hypergeometric functionality, and I suspect this is the main issue. Are there any conceivable workarounds?

This actually works out of the box in the latest development release, probably with the same fix in #16224.

sage: sum(x^(3*k)/factorial(2*k),k,0,oo)
sqrt(pi)*x^(3/4)*sqrt(1/(pi*x^(3/2)))*cosh(x^(3/2)) 
sage:  sum(x^(3*k)/factorial(2*k),k,0,oo).simplify_radical()
cosh(x^(3/2))


Reply all
Reply to author
Forward
0 new messages