0603 Resistor Bias

Thread Starter

joeyd999

Joined Jun 6, 2011
6,309
Here is a histogram of the likelihood of achieving success with 100 coins on throw # t:

Selection_044.png

The expected value is about 7.98 tosses.
 

cmartinez

Joined Jan 17, 2007
8,768
Very interesting thread. And the probability calculations done by Bahn and Joey seem pretty much spot-on. Following the line of Joey's OCD for neatness and soldering all of the labeled smt components face up (a practice that I wholeheartedly agree with), in practice what I do is I peel the plastic film off the cardboard strip containing the smt components, and drop them on a petri dish. Then I start picking those that landed face up and solder them. And after those run out, I simply gently tap the dish against the table, and a little less than half (as Joey pointed out) of them land face up, and continue to work.

The annoying part comes when only 6 or 7 components are left in the dish, and have to tap more than once sometimes for at least one of them to land face up.
 
Last edited:
This doesn't match what you would expect from a few different perspectives.

First, the odds that a given coin survives 19 tosses without coming up heads at least once is less than two in a million. But that is what is required to even need a 20th toss.

Second, if we only have ten coins but it takes twenty tosses to get them all heads up, that means that we expect to get a single coin to land heads-up every other toss. That means that we expect ALL of the remaining coins to land tails-up on half of the tosses. Does that sound reasonable?

Third, , just playing it on paper, you would expect something like this (and rounding half a tail to a full tail to make the number of tosses higher until we get to a single coin, then I'll let it land tails the first time and finally heads the second time):

Toss 1: 5 tails
Toss 2: 3 tails
Toss 3: 2 tails
Toss 4: 1 tail
Toss 5: 1 tail
Toss 6: 0 tails

So that's just 6 tosses even though things were biased in favor of a higher toss count.

As @joeyd999 correctly surmised in the original post, this process is clearly O(log(n)) where n is the number of coins/resistors.
I think it does add up. The OP has used the example (see post #32) of the number of tosses "expected" to get 1000 heads. According to what I have proposed, the expected value in that case would be 2000.

So, let's simulate using some hastily constructed VB.net code. This code will output a distribution of the number of tosses required to get 1000 heads. NOTE: It will write the data to a text file.

A sample txt file of output is attached. Edited to add: that is, the file contains 1000 entries. Each entry is the number of flips it took to get 1000 heads.

Code:
Imports System.IO

Module Module1

  Sub Main()
  Console.WriteLine(vbCrLf + "Start ")
  Dim nheads
  Dim ntails
  Dim ntosses
  Dim draw
  Dim trials
  Dim sw As StreamWriter

  sw = New StreamWriter("cointossdata012345.txt")
  trials = 0
  Do
  nheads = 0
  ntosses = 0
  ntails = 0
  Do
  Randomize()
  draw = Int(10 * Rnd() + 1)
  ntosses += 1
  If draw > 5 Then
  nheads += 1
  Else
  ntails += 1
  End If
  Loop Until (nheads = 1000)
  Console.Write("tosses=")
  Console.Write(ntosses)
  Console.Write(" heads=")
  Console.Write(nheads)
  Console.Write(" tails=")
  Console.Write(ntails)
  Console.Write(vbCrLf)

  sw.WriteLine(ntosses)
  trials += 1
  Loop Until (trials = 1000)
  Console.Write(vbCrLf + "finished... ")
  sw.Close()
  'Console.Write(vbCrLf + "Press any key to exit... ")
  Console.ReadKey(True)
  End Sub

End Module
The simple descriptive statistics for a run are as follows:
mean=2001.8590
median=1987.5000
standard deviation=137.0886
standard error=4.3351
95% CI=8.5071
99% CI= 11.1887

Very close to what I expected.
 

Attachments

Last edited:

Thread Starter

joeyd999

Joined Jun 6, 2011
6,309
I think it does add up. The OP has used the example (see post #32) of the number of tosses "expected" to get 1000 heads. According to what I have proposed, the expected value in that case would be 2000.

So, let's simulate using some hastily constructed VB.net code. This code will output a distribution of the number of tosses required to get 1000 heads. NOTE: It will write the data to a text file.

A sample txt file of output is attached.

Code:
Imports System.IO

Module Module1

  Sub Main()
  Console.WriteLine(vbCrLf + "Start ")
  Dim nheads
  Dim ntails
  Dim ntosses
  Dim draw
  Dim trials
  Dim sw As StreamWriter

  sw = New StreamWriter("cointossdata012345.txt")
  trials = 0
  Do
  nheads = 0
  ntosses = 0
  ntails = 0
  Do
  Randomize()
  draw = Int(10 * Rnd() + 1)
  ntosses += 1
  If draw > 5 Then
  nheads += 1
  Else
  ntails += 1
  End If
  Loop Until (nheads = 1000)
  Console.Write("tosses=")
  Console.Write(ntosses)
  Console.Write(" heads=")
  Console.Write(nheads)
  Console.Write(" tails=")
  Console.Write(ntails)
  Console.Write(vbCrLf)

  sw.WriteLine(ntosses)
  trials += 1
  Loop Until (trials = 1000)
  Console.Write(vbCrLf + "finished... ")
  sw.Close()
  'Console.Write(vbCrLf + "Press any key to exit... ")
  Console.ReadKey(True)
  End Sub

End Module
The simple statistics for a run are as follows:
mean=2001.8590
median=1987.5000
standard deviation=137.0886
standard error=4.3351
95% CI=8.5071
99% CI= 11.1887

Very close to what I expected.
You seem to be adding only one head or one tail each toss. This is not the problem.
 
You seem to be adding only one head or one tail each toss. This is not the problem.
I have no idea what you mean. If you toss a coin, you only get either one head or one tail. The problem would be if you are getting something else.

Edited to add: Since you know this, let me try it another way that goes back to my first post.

Calculating the number of tosses of ONE coin to get 10 heads. Let's say it took 32 tosses of that one coin to get 10 heads. It is exactly the same situation probability-wise as:

Taking 20 coins, tossing them all (that counts as 20 tosses). Let's say that 12 of them are heads.

Now, you take the 8 "tail" coins and toss them all up (that counts as 8 toss for a total of 28 tosses so far). Six of those 8 tosses resulted in heads.

Now, you take the remaining two "tail" coins and toss them up and they both come down as tails (now you are up to 30 tosses).

Now you take the two "tails" and toss them again and they both come up as heads. Now you have made 32 tosses to get 10 heads.
 
Last edited:

Thread Starter

joeyd999

Joined Jun 6, 2011
6,309
I have no idea what you mean. If you toss a coin, you only get either one head or one tail. The problem would be if you are getting something else.
In the specification, I declared that tossing a group of heads-down coins was to be consider a single toss. Therefore, if you have n heads-down coins, from 0 to n of them can become heads-up on a single toss.
 

Thread Starter

joeyd999

Joined Jun 6, 2011
6,309
Calculating the number of tosses of ONE coin to get 10 heads. Let's say it took 32 tosses of that one coin to get 10 heads. It is exactly the same situation probability-wise as:
I think the difference is I only need one head in each of N coins, not N heads out of one coin. You are trying to serialize a parallel problem, and are assuming equivalence where none should be expected.
 
In the specification, I declared that tossing a group of heads-down coins was to be consider a single toss. Therefore, if you have n heads-down coins, from 0 to n of them can become heads-up on a single toss.
OMG! I don't even know how to respond to that. So, you define a toss as containing some varying number of coins. If you toss 10, 20, or 1, each event counts as just one toss. Ok, got ya, my mistake, I should have known better.
 
Last edited:

Thread Starter

joeyd999

Joined Jun 6, 2011
6,309
OMG! I don't even know how to respond to that. So, you define a toss as containing some varying number of coins. If you toss 10, 20, or 1, each event counts as just one toss. Ok, got ya, my mistake, I should have known better.
This is the way I originally described the problem, and the only way it makes sense in context.

What should you have known better?

And quit editing the content of your posts after they have been replied to without indicating such. It's getting annoying.
 

WBahn

Joined Mar 31, 2012
32,878
Very interesting thread. And the probability calculations done by Bahn and Joey seem pretty much spot-on. Following the line of Joey's OCD for neatness and soldering all of the labeled smt components face up (a practice that I wholeheartedly agree with), in practice what I do is I peel the plastic film off the cardboard strip containing the smt components, and drop them on a petri dish. Then I start picking those that landed face up and solder them. And after those run out, I simply gently tap the dish against the table, and a little less than half (as Joey pointed out) of them land face up, and continue to work.

The annoying part comes when only 6 or 7 components are left in the dish, and have to tap more than once sometimes for at least one of them to land face up.
I take an even more primitive approach. I like to be able to work under a binocular microscope and so I put the parts I need in the general area of the PCB that I will be using them. I seldom have more than a couple dozen components on the board at a time and almost never more than ten or so in a given region. So it is a simple matter for me to just use my tweezers to turn over any components that are face down when I get to that section of the board. Since I need to pick up each component sooner or later, it's virtually the same amount of effort. I generally place the components that are face up first (being lazy) and then pick up a face-down component at one end, turn it over, and then move it to where it needs to go.

I had one design that used a LOT of 100 Ω resistors on the board, so for those I did almost what you are talking about. I took a very thin (maybe 1/8") piece of foam and put a small sheet of plastic (both antistatic just to keep the resistors from sticking to it). After I had used all of the face up ones, I simply moved the foam onto a piece of cardboard, placed another sheet of plastic on top, another piece of foam on top of that, another piece of cardboard on top of that. I then picked it up and, while applying some pressure to clamp everything together, turned if over and then pulled of the upper layers. Now all of the remaining resistors were face up and I was good to go. I don't know that I needed the cardboard, but I felt more confident that I wouldn't have resistors sliding out as I rotated the assembly that way.
 
This is the way I originally described the problem, and the only way it makes sense in context.

What should you have known better?

And quit editing the content of your posts after they have been replied to without indicating such. It's getting annoying.
Here we go.... where you go overboard and want to fight, you want to troll, you want to get into it ...as usual.

As I have stated previously, it is difficult for me to express how disinterested I am in any problem you have with my behavior. Again, as I have suggested, if you don't like something I have posted or edited, than don't read it. Beyond that, and with all due respect, your comments at this point are likely to only get the usual *yawn*.
 

Thread Starter

joeyd999

Joined Jun 6, 2011
6,309
Here we go.... where you go overboard and want to fight, you want to troll, you want to get into ...as usual.

As I have stated previously, it is difficult for me to express how disinterested I am in any problem you have with my behavior. Again, as I have suggested, if you don't like something I have posted or edited, than don't read it. Beyond that, and with all due respect, your comments at this point are likely to only get the usual *yawn*.
How the hell can I troll my own thread? Look in the mirror, dammit.

I was politely discussing your solution. You seem to have taken offense.
 

WBahn

Joined Mar 31, 2012
32,878
MOD NOTE: Gentlemen, please let's not let this degenerate. A misinterpretation was made, it took a bit of back and forth to identify what it was and to clear it up. It has been cleared up. Let's move on with the discussion of the problem now that everyone is on the same page.
 
Top