Opened 9 years ago

Closed 6 years ago

# maxima sum returns hypergeometric function

Reported by: Owned by: schilly burcin major sage-duplicate/invalid/wontfix symbolics hypergeometric eviatarbach Karl-Dieter Crisman, Ralf Stephan N/A

### Description

The parsing of Maxima's output is not good enough to handle this:

```var('n')
sum(((2*I)^n/(n^3+1)*(1/4)^n), n, 0, infinity)
```

gives an exception

```TypeError: unable to make sense of Maxima expression 'f[4,3]([1,1,-(sqrt(3)*I+1)/2,(sqrt(3)*I-1)/2],[2,-(sqrt(3)*I-1)/2,(sqrt(3)*I+1)/2],I/2)' in Sage
```

which is - i think - a f_43 hypergeometric function.

### comment:1 Changed 9 years ago by schilly

one additional example by omologos on irc:

```var('x n')
f=(-1)^n/((2*n+1)*factorial(2n+1))
sum(f,n,0,oo)
```

but i get this error:

```TypeError: unable to make sense of Maxima expression 'f[1,2]([1/2],[3/2,3/2],-1/4)' in Sage
```

### comment:2 Changed 9 years ago by kcrisman

This should be

```var('x n')
f=(-1)^n/((2*n+1)*factorial(2*n+1))
sum(f,n,0,oo)
```

If I'm not mistaken, this might be related to #2516, in the sense that we should be parsing hypergeometric functions correctly and that would be part of that ticket.

### comment:4 Changed 7 years ago by eviatarbach

This also causes a similar problem in #4102:

```sage: f = bessel_J(2, x)
sage: f.integrate(x)
Traceback (most recent call last):
...
TypeError: cannot coerce arguments: no canonical coercion from <type 'list'> to Symbolic Ring
```

In that case, Maxima is returning `hypergeometric([3/2],[5/2,3],-x^2/4)`.

### comment:5 Changed 6 years ago by jdemeyer

• Milestone changed from sage-5.11 to sage-5.12

### comment:7 Changed 6 years ago by vbraun_spam

• Milestone changed from sage-6.1 to sage-6.2

### comment:9 Changed 6 years ago by kcrisman

And see this sage-support thread for possibly another example.

### comment:10 Changed 6 years ago by vbraun_spam

• Milestone changed from sage-6.2 to sage-6.3

### comment:11 follow-up: ↓ 12 Changed 6 years ago by kcrisman

#2516 has all the examples above in it, with the exception of the ones mentioned in the comments.

• One would want to be able to do
```b=var('b')
integral(1/(x^b+1),x)
```
without using W|A; apparently `1/(a^b+1)` would yield `2F1(1,1/a,1+1/a,-a^x)`.
• Apparently
```sum(x^(3*k)/factorial(2*k),k,0,oo)
```
would also be doable with hypergeometrics.

### comment:12 in reply to: ↑ 11 ; follow-up: ↓ 13 Changed 6 years ago by rws

#2516 has all the examples above in it, with the exception of the ones mentioned in the comments.

What I get with #2516 is

```sage: integral(1/(x^b+1),x)
integrate(1/(x^b + 1), x)
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))
```

### comment:13 in reply to: ↑ 12 ; follow-up: ↓ 14 Changed 6 years ago by kcrisman

• Reviewers set to Karl-Dieter Crisman, Ralf Stephan
• Status changed from new to needs_review

What I get with #2516 is

```sage: integral(1/(x^b+1),x)
integrate(1/(x^b + 1), x)
```

Not really worth keeping open, as even Maxima does this.

```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))
```

Interestingly, this works in vanilla Sage as well. Maybe there weren't any hg functions to begin with there. I assume it was fixed with #16224 - earlier it gave yet another (wrong) answer.

So I nominate to close this ticket.

### comment:14 in reply to: ↑ 13 Changed 6 years ago by kcrisman

• Status changed from needs_review to positive_review
```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))
```

Interestingly, this works in vanilla Sage as well. Maybe there weren't any hg functions to begin with there. I assume it was fixed with #16224 - earlier it gave yet another (wrong) answer.

Even more interestingly, this is not as simple as just `cosh(x^(3/2))` (which is correct) but I'm not going to repurpose this one for that.

### comment:15 Changed 6 years ago by rws

• Milestone changed from sage-6.3 to sage-duplicate/invalid/wontfix

Practically a duplicate of #2516

### comment:16 Changed 6 years ago by vbraun

• Resolution set to duplicate
• Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.