# Problem with hypergeometric

A = lambda z: exp(I*pi*z)*hypergeometric([-z,1/2],,4).simplify_hypergeometric()
print A(1/2)


-1/2sqrt(3)assoc_legendre_p(1/2, -1, -5/3)

print (-1/2*sqrt(3)*assoc_legendre_p(1/2, -1, -5/3)).n()


name 'assoc_legendre_p' is not defined

print A(1/2).n()


TypeError: cannot evaluate symbolic expression numerically

Question: Which option do I have except to switch over to Maple?

A := z -> exp(I*Pi*z)*hypergeom([-z,1/2],,4):
evalf(A(1/2)); -0.3697166872 + 0.4838437556 I

edit retag close merge delete

Thanks Ralf! Indeed I have another option: To try a different formula. I will report -- stay tuned!

Sort by » oldest newest most voted

The link from Maxima's assoc_legendre_p to Sage's gen_legendre_P will be done by ticket #16813 (among many other things). Until then you must do manually

sage: assoc_legendre_p = gen_legendre_P
sage: print (-1/2*sqrt(3)*assoc_legendre_p(1/2, -1, -5/3)).n()
...
TypeError: no conversion of this rational to integer


which however shows that Maxima itself cannot handle the function with non-integer index. Using the branch in the ticket gives

sage: assoc_legendre_p = gen_legendre_P
sage: print (-1/2*sqrt(3)*assoc_legendre_p(1/2, -1, -5/3)).n()
-0.483843755630126 + 0.369716687246133*I

more

Well, this is only about the assoc_legendre_p problem which is secondary to my hypergeometric problem. If Sage would have answered with (1/3I)(3EllipticK(2)+5EllipticE(2))/Pi I would also be happy.