I have a function in sympy which is quite ugly:
In [79]: print(expected_c)
Out[79]: 2**(n - 2)*n*(n - 1)*binomial(m, n)*factorial(m - 3/2)*factorial(m - n)/(binomial(2*m, n)*factorial(m - n/2)*factorial(m - n/2 - 1/2))
I want to solve it for some $m$ (say 10000) to find $n$ such that my formula values, say 4.
It is easy to do it 'by hand' by graphing it, and to see that it reaches 4 for about n=400. Then I try this value:
In [64]: expected_c.subs([(m,10000), (n,400)]).evalf()
Out[64]: 3.9901995099755
However the numerical solver fail to find this value:
In [82]: sympy.nsolve(expected_c.subs(m,10000.0)-4.0,n,400)
Out[82]: mpf('nan')
Is there a way to make it work or do I have to code a numerical solver myself ? Even a stupid one could do the job as I do not need a high precision but I was thinking Sympy should be able to do that.