Hi there anyone!!
why does the code count the number one for only 29 times when it is really 39 “1.” in the following code : in countGreaterThan1 line
expression= (179424673(n+9999980*2(179424407+n)))/((179424407+n) (-0.32+n+179424407(9999980*2+n)))
simplifiedExpression = Refine[expression, Assumptions -> n > 0]
simplifiedExpression = Simplify[expression, Assumptions -> n > 0]
results = Table[simplifiedExpression, {n, 1, 100}]
list=results
countGreaterThan1 = Count[list, _?(# >= 1 &)]
mm=countGreaterThan1
m=mm*0.08842297174111212397447584320875
resposta=mm-m
posição provável=((mm+resposta)/2)/2
mroge02
(Michael Rogers)
June 7, 2024, 7:55pm
2
list - 1 shows only 29 positive numbers.
I think what you responding to is that floating-point numbers are shown rounded to six digits in the front end. You’re seeing many “1.” that are really numbers that are greater or less than 1 by less than 10^{-6} .
You can see all digits by executing Style[list, PrintPrecision -> 17].
I would rather work with exact rational numbers:
expression = (179424673 (n + 9999980*2 (179424407 + n)))/((179424407 +
n) (-0.32 + n + 179424407 (9999980*2 + n))) // Rationalize
results = Table[expression, {n, 1, 100}];
Count[results, r_ /; r >= 1]
Plot[expression, {n, 0, 100}, GridLines -> {{29}, {1}}]