This probably has not much to do with Sage, but I need some help. I am using the binom package of scipy.stats to solve how many trials (N) I would need to get 40 or more successes at least in 2% of the times. Basically what I am doing with sage is:

from scipy.stats import binom
from scipy.stats import fsolve

def mybinom(N):
   return 1-binom(N,p).cdf(40)

fsolve(mybinomial(N)-0.02, 100)

however this returns an error:

TypeError: unsupported operand type(s) for *: 'numpy.ndarray' and 'numpy.bool_'


is there anything similar to the command FindRoot in mathematica ???

g[N_] := Interpolation[Table
FindRoot[g[x] == 0.02 , n, {x, 100, 101}, MaxIterations -> 1000]

I tried some of the scalar optimizations of scipy.optimize but I could not get it working.

Thanks a lot in advance!

--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to