Calculating the n-th term of the series expansion of a special function [closed]

I am trying to calculate the $n^{\text{th}}$ term of the following polynomial:

$$\, _2F_1\left(-n,n+3;\frac{3}{2};x\right)$$

To do this I calculate:

c[k_] = SeriesCoefficient[
Hypergeometric2F1[-n, n+3, 3/2, x], {x, 0, k},
Assumptions -> k >= 0
];

and get:

c[k] //TeXForm

$\frac{\sqrt{\pi } (k-n-1)! (k+n+2)!}{2 k! \left(k+\frac{1}{2}\right)! (-n-1)! (n+2)!}$

and the problem is when I try to calculate for $n=10$:

Block[{n = 10}, Sum[c[k] x^k, {k, 0, 10}]]

Infinity::indet: Indeterminate expression (0 2 Sqrt[π] ComplexInfinity)/Sqrt[π] encountered.

Infinity::indet: Indeterminate expression (0 4 Sqrt[π] ComplexInfinity)/(3 Sqrt[π]) encountered.

Infinity::indet: Indeterminate expression (0 8 Sqrt[π] ComplexInfinity)/(15 Sqrt[π]) encountered.

General::stop: Further output of Infinity::indet will be suppressed during this calculation.

Indeterminate

I get error messages and an incorrect answer. The correct result is:

Hypergeometric2F1[-n, n+3, 3/2, x] /. n->10

1/33 (33 - 2860 x + 72072 x^2 - 823680 x^3 + 5125120 x^4 - 19009536 x^5 + 43868160 x^6 - 63504384 x^7 + 56033280 x^8 - 27525120 x^9 + 5767168 x^10)

Other manifestations of problems with c:

Block[{n=10}, c[k]]
Block[{n=10}, c]

0

Infinity::indet: Indeterminate expression -((128 0 64 316234143225 Sqrt[π] Sqrt[π] ComplexInfinity)/(135135 10395 4096 Sqrt[π] Sqrt[π])) encountered.

Indeterminate

c does not give a useful symbolic result for the $k^{\text{th}}$ term of the series.

I try to use assumptions but it does not help.

closed as unclear what you're asking by bbgodfrey, rhermans, Daniel Lichtblau, MarcoB, José Antonio Díaz NavasSep 5 '18 at 11:17

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• It will be impossible to determine why you are getting an error without code. – N.J.Evans Aug 30 '18 at 12:30
• please how to paste the code i copy from mathematica +crtl K but do not work – Clerk Aug 30 '18 at 12:47
• The code corresponding to the question gives me the correct answer with no error messages. I suggest saving your notebook (without any extraneous material), restarting Mathematica, and then executing the notebook. If that does not work, check your code for errors. – bbgodfrey Aug 30 '18 at 13:49
• Do the Sum first (with n left undefined, then substitute n->10 in the result. This will avoid the indeterminate forms. – Daniel Lichtblau Aug 30 '18 at 17:04
• If the comment by Daniel ( %/.n->10 ) doesn't solve your problem, when using a fresh kernel as suggested by bbgodfrey, then it's not clear what you are asking. Please edit your question to clarify. – rhermans Aug 31 '18 at 7:51

It seems that the output generated by SeriesCoefficient is difficult for Mathematica to simplify into a version that can evaluate properly for integer n. So, I recommend using the new symbolic order derivatives introduced in M11.1:

c[k_] = Assuming[
n>=1,
Simplify @ D[Hypergeometric2F1[-n, n+3, 3/2, x], {x, k}]/k! /. x->0
]

(Pochhammer[-n, k] Pochhammer[3 + n, k])/(k! Pochhammer[3/2, k])

Note that this version of the symbolic coefficient of the series evaluates correctly for explicit values of n and k:

Block[{n=10}, c]

-6336512/11

Let's check:

r1 = Block[{n=10}, Sum[c[k] x^k, {k, 0, n}]];
r1 // TeXForm

$\frac{524288 x^{10}}{3}-\frac{9175040 x^9}{11}+\frac{18677760 x^8}{11}-\frac{21168128 x^7}{11}+\frac{14622720 x^6}{11}-\frac{6336512 x^5}{11}+\frac{465920 x^4}{3}-24960 x^3+2184 x^2-\frac{260 x}{3}+1$

Compare to the exact answer:

r2 = Block[{n=10}, Expand @ Hypergeometric2F1[-n,n+3,3/2,x]];
r2 // TeXForm

$\frac{524288 x^{10}}{3}-\frac{9175040 x^9}{11}+\frac{18677760 x^8}{11}-\frac{21168128 x^7}{11}+\frac{14622720 x^6}{11}-\frac{6336512 x^5}{11}+\frac{465920 x^4}{3}-24960 x^3+2184 x^2-\frac{260 x}{3}+1$

They are the same:

r1 === r2

True

The OP asks in a comment about a different hypergeometric function argument:

c[k_]=Assuming[
n>=1,
Simplify @ D[Hypergeometric2F1[3/2+n, -(3/2)-n, 3/2, x], {x, k}]/k! /. x->0
];

r1 = Block[{n=10}, Sum[c[k] x^k, {k, 0, n}]];
r1 //TeXForm

$\frac{515830463005 x^{10}}{262144}-\frac{264205846905 x^9}{65536}+\frac{165491574435 x^8}{32768}-\frac{8448518815 x^7}{2048}+\frac{2304141495 x^6}{1024}-\frac{2304141495 x^5}{2816}+\frac{24775715 x^4}{128}-\frac{452295 x^3}{16}+\frac{18515 x^2}{8}-\frac{529 x}{6}+1$

r2 = Block[{n=10}, Hypergeometric2F1[3/2+n, -(3/2)-n, 3/2, x] //Expand];
r2 //TeXForm

$-\frac{524288}{3} \sqrt{1-x} x^{11}+\frac{33292288}{33} \sqrt{1-x} x^{10}-\frac{27852800}{11} \sqrt{1-x} x^9+\frac{39845888}{11} \sqrt{1-x} x^8-\frac{35790848}{11} \sqrt{1-x} x^7+\frac{20959232}{11} \sqrt{1-x} x^6-\frac{24134656}{33} \sqrt{1-x} x^5+\frac{540800}{3} \sqrt{1-x} x^4-27144 \sqrt{1-x} x^3+\frac{6812}{3} \sqrt{1-x} x^2-\frac{263}{3} \sqrt{1-x} x+\sqrt{1-x}$

The difference between them is that r1 is a series approximation of r2. When r2 is not a degree 10 polynomial, than the two expressions will not be the same. Instead compare r1 with the series approximation of r2:

r2 + O[x]^11 //TeXForm

$1-\frac{529 x}{6}+\frac{18515 x^2}{8}-\frac{452295 x^3}{16}+\frac{24775715 x^4}{128}-\frac{2304141495 x^5}{2816}+\frac{2304141495 x^6}{1024}-\frac{8448518815 x^7}{2048}+\frac{165491574435 x^8}{32768}-\frac{264205846905 x^9}{65536}+\frac{515830463005 x^{10}}{262144}+O\left(x^{11}\right)$

• Thanks Carlk for your help it is works when n is neative interger but i try with n=3/2-n and do not work for example c[k_] = Assuming[n >= 1, Simplify@D[Hypergeometric2F1[3/2 + n, -(3/2) - n, 3/2, x], {x, k}]/ k! /. x -> 0] r1 = Block[{n = 10}, Sum[c[k] x^k, {k, 0, n}]]; r1 r2 = Block[{n = 10}, Hypergeometric2F1[3/2 + n, -(3/2) - n, 3/2, x] // Expand]; r2 gives different result check it if you will ,(sorry i could paste de code cause i paste from mathematica +Crtl K but do not work for me thanks anyway – Clerk Aug 31 '18 at 9:59
• Thanks Carlk now it is very clear – Clerk Aug 31 '18 at 13:42

Instead = write := at function c[k_]

$Version (* "11.3.0 for Microsoft Windows (64-bit) (March 7, 2018)"*) ClearAll["Global*"]; Remove["Global`*"];(* Clears the kernel *) c[k_] := SeriesCoefficient[Hypergeometric2F1[-n, n + 3, 3/2, x], {x, 0, k}] Block[{n = 10}, Sum[c[k] x^k, {k, 0, 10}]]$\frac{524288 x^{10}}{3}-\frac{9175040 x^9}{11}+\frac{18677760 x^8}{11}-\frac{21168128 x^7}{11}+\frac{14622720 x^6}{11}-\frac{6336512 x^5}{11}+\frac{465920 x^4}{3}-24960 x^3+2184 x^2-\frac{260 x}{3}+1\$