How can I write in Mathematica an expression like this?

$$\sum_{k=1}^n {_{k}F_{k}} (1,1,\dots,1; \,2,2,\dots,2; \,z) ~,$$

where ${_{p}F_{q}}$ is the generalized hypergeometric function.

My problem is that I don't know how to use variable number of arguments, which depends on a parameter.


Thanks to ConstantArray[], not much effort is needed:

mysum[n_Integer, z_] :=
   Sum[HypergeometricPFQ[ConstantArray[1, k], ConstantArray[2, k], z], {k, 1, n}]


mysum[3, z]
   (-1 + E^z)/z + HypergeometricPFQ[{1, 1, 1}, {2, 2, 2}, z] +
   (-EulerGamma - Gamma[0, -z] - Log[-z])/z
  • 2
    $\begingroup$ Table[1, k] and Table[2, k] are slightly more compact. $\endgroup$ – Bob Hanlon Aug 15 '15 at 16:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.