Register to reply 
Probability of 0 bit in ASCII text files 
Share this thread: 
#37
Nov2612, 12:20 AM

P: 54

Just can`t quiet figure out how N=8A+B works. 


#38
Nov2612, 02:34 PM

Homework
Sci Advisor
HW Helper
Thanks
P: 9,922

See what gaps you can fill in here: Prob that this includes A+1 MSB's = ....?; if A+1 MSBs, prob that all N bits are 0 is ...? Prob that this includes A MSB's = ....?; if A MSBs, prob that all N bits are 0 is ...? Adding this up, prob that all N bits are 0 is ...? 


#39
Nov2712, 05:48 AM

P: 54

Analysis: Since the N bits are drawn consecutively from ASCII, there is only 1 character (out of 2^256), which is are all 0. So only 1 MSB. Thus, the Prob =1/2^256. Others seem to follow the conception , or I misunderstood your point? Question: 1) Pr[0] in ASCII (assume each character appears with same ratio) equals = 1/8+1/2=5/8. Is it OK? 2) Successive 7 bits are drawn at random from ASCII bits (e.g. no bias of character distribution), what is Pr[0] in the 7 bits? Successive 4 bits are drawn (same condition with above), what is Pr[0] in the 4 bits? So, say, Successive N bits are drawn (same condition) , what is Pr[0] in the N bits? Analysis: Do you think it is same case? remember you explained that N/8*2^N + (1N/8)*2^(N+1) . Does the formula apply to the case of 2). Shed some lights on please. 


#40
Nov2712, 02:26 PM

Homework
Sci Advisor
HW Helper
Thanks
P: 9,922

If the N bits include A MSBs then how many nonMSBs do they include? What is the prob that the A MSBs are all 0? What is the prob that the nonMSBs are all 0? So what is the prob that all N bits are 0? 


#41
Dec112, 12:55 AM

P: 54

Now, say, two N consecutive bits are taken (or two groups) (_{N1}=7, and _{N2}=4). So the prob is different in following cases in comparing of same amount of 0`s? 1st case: (in _{N1=7}) Pr[0], Pr[00],..,Pr[0000] =? 2nd case: (in _{N2=4}) Pr[0], Pr[00],..,Pr[0000] =? 


#42
Dec112, 02:17 PM

Homework
Sci Advisor
HW Helper
Thanks
P: 9,922




#43
Dec112, 10:15 PM

P: 54

I meant the prob of 0 within _{N1} =7 consecutively drawn from ASCII . In other words, say, now we have a group of bits consists of many _{N1}, each of which is consecutive 7 bits drawn from ASCII. what is Prob[0], Prob[00] in the group respectively? 2nd case. another group of bits with same condition, where _{N2}=4. What is Prob[0], Prob[00] within the second group respectively? Is (_{N1})Prob[0] = (_{N2})Prob[0] right, or should it be unequal? 


#44
Dec212, 12:18 AM

Homework
Sci Advisor
HW Helper
Thanks
P: 9,922




#45
Dec212, 12:34 AM

P: 54

(_{N1}=7)Prob[0] = (_{N2}=4)Prob[0] (_{N1}=7)Prob[00] = (_{N2}=4)Prob[00] (_{N1}=7)Prob[000] = (_{N2}=4)Prob[000] .... 


#46
Dec212, 02:10 PM

Homework
Sci Advisor
HW Helper
Thanks
P: 9,922

To be completely clear:
If you choose N consecutive bits, the probability that the first R of those bits are all zero (R <= N), depends only on R. It cannot depend on N. Further, if you choose N consecutive bits, then choose R consecutive bits from those N, the probability that the first R of those bits are all zero depends only on R. (This seems so obvious that I worry that I have not understood the question.) 


#47
Dec212, 08:40 PM

P: 54

take R=2 bits from N_{1} & N_{2} respectively, what is prob that they are two 0 bits. 1st. (N_{1} case) : {_{(9X/16)}C_{2} * _{(7X/16)}C_{5} } / _{x}C_{7}. 1st. (N_{2} case) : {_{(9X/16)}C_{2} * _{(7X/16)}C_{2} } / _{x}C_{4}. Seems it depends on N too. 


#48
Dec212, 08:52 PM

Homework
Sci Advisor
HW Helper
Thanks
P: 9,922




#49
Dec212, 09:03 PM

P: 54

X: number of ASCII bits , from which N is taken. Pr[0] = 9/16. _{x}C_{7} : The number of combinations of x , taken 7 at a time. 


#50
Dec212, 09:11 PM

Homework
Sci Advisor
HW Helper
Thanks
P: 9,922




#51
Dec212, 09:54 PM

P: 54

Pr[0] = 9/16. X: number of ASCII bits , from which N is taken. case: N1=7 & N2=4 . Assume N is taken from X bits, which is ASCII. Other definitions should be clear 


#52
Dec212, 10:08 PM

Homework
Sci Advisor
HW Helper
Thanks
P: 9,922




#53
Dec312, 05:46 AM

P: 54

9X/16: The number of 0 bits in the X that are classified as successes. 7 or 4: The number(s) of bits taken consecutively from X. 2: The number of 2 zeros in the 7 or 4 that are classified as successes. _{(9X/16)}C_{2} : The number of combinations of 9X/16, taken two 0 bits at a time. 


#54
Dec312, 01:23 PM

Homework
Sci Advisor
HW Helper
Thanks
P: 9,922

For one thing, that analysis treats all bits as independently 0 or 1, regardless of their proximity to each other. Bits multiples of 8 positions apart will be positively correlated, and at other distances negatively correlated. More significantly, let's look at what these represent: 1st. (N1 case) : {(9X/16)C2 * (7X/16)C5 } / xC7. 1st. (N2 case) : {(9X/16)C2 * (7X/16)C2 } / xC4. The first is the probability of picking 7 bits that are exactly two 0 bits and 5 1 bits; the second is the prob of picking 4 bits that are exactly 2 and 2. No wonder they're different! In the problem I thought we were discussing, P[00] doesn't care what the remaining 2 or 5 bits are. 


Register to reply 
Related Discussions  
How read text files on CASIO fx9860GII SD?  Calculators  2  
Several ascii files, read, write, average?  Programming & Computer Science  5  
Read multiple binary files to ascii  Programming & Computer Science  0  
Fortran 90 question about reading files with text  Programming & Computer Science  1  
Indexing a lot of text/pdf files  Computing & Technology  1 