First time here? Check out the FAQ!

Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

answered 10 years ago

nbruin gravatar image

There's definitely a bug in the numerical evaluation of hypergeometric functions here, but if you are interested in the integer values that this sequence takes, .n() is the wrong tool anyway.

As was noted already, Maxima knows how to evaluate these hypergeometric functions properly and does so without numerical approximation. The easier way to get the sequence you want is to give maxima an opportunity to look at the expression, which is what "simplify" does. So:

sage: [A182122(n).simplify() for n in (0..15)]
[1, 2, 2, 0, -2, 0, 4, 0, -10, 0, 28, 0, -84, 0, 264, 0]

If you don't like simplify because it might do strange things, simply round-tripping to maxima works too:

sage: [ZZ(maxima_calculus(A182122(n))) for n in (0..15)]
[1, 2, 2, 0, -2, 0, 4, 0, -10, 0, 28, 0, -84, 0, 264, 0]

(and you'll get a sequence of integers that way, not a sequence of symbolic expressions that happen to be integers)

click to hide/show revision 2
No.2 Revision

There's definitely a bug in the numerical evaluation of hypergeometric functions here, but if you are interested in the integer values that this sequence takes, .n() ".n()" by itself is the wrong tool anyway.a bit risky: You'd need to instruct it to produce a result to sufficient precision that rounding gives you the correct answer.

As was noted already, Maxima knows how to evaluate these hypergeometric functions properly and does so without numerical approximation. The easier way to get the sequence you want is to give maxima an opportunity to look at the expression, which is what "simplify" does. So:

sage: [A182122(n).simplify() for n in (0..15)]
[1, 2, 2, 0, -2, 0, 4, 0, -10, 0, 28, 0, -84, 0, 264, 0]

If you don't like simplify because it might do strange things, simply round-tripping to maxima works too:

sage: [ZZ(maxima_calculus(A182122(n))) for n in (0..15)]
[1, 2, 2, 0, -2, 0, 4, 0, -10, 0, 28, 0, -84, 0, 264, 0]

(and you'll get a sequence of integers that way, not a sequence of symbolic expressions that happen to be integers)