This is what I'm trying to run:
########
var('n,i')
n = 36000
sum((factorial(n) / (factorial(n-i) * factorial(i))) * 0.00625**i * 
(1-0.00625)**(n-i), i, 0, 250)
########

This is what I get: NaN


To be up front, I ran into this problem while trying this exact equation 
with NumPy and SciPy. In searching for help it was agreed that I was 
overflowing the Python data types, and among various answers was the 
suggestion that I could simply use different data types from libraries more 
suited to such numbers. That worked, but what I'm really searching for now 
is a way to use Python for my math work that doesn't require I think about 
whether variables are going to overflow.

SageMath seems to nearly work. I can do a sum with only the factorials, and 
I get a huge number (which is good). I can do the sum with just the 
fractional powers, and I get a minuscule number (also good). Multiplying 
them manually in Sage, I get +infinity. I understand there are much 
easier/smarter ways to use the binomial theorem, but at the time I needed 
to solve for 'n' and the best way to do that (that I could figure out) was 
to use the binomial formula. The code above is really just an example of 
the problem.


Does anyone know what in particular is causing the sum to fail?

Much appreciated!
Chris

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to