Group Abstract Group Abstract

Message Boards Message Boards

0
|
2K Views
|
3 Replies
|
5 Total Likes
View groups...
Share
Share this post:

Fixing a code that gives wrong count value

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
3 Replies

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}}]
POSTED BY: Gianluca Gorni
POSTED BY: Michael Rogers

Thank you so much!!

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard