Saturday, March 26, 2011

Calibrating a scale

A digital scale is an instrument that should be found in any modern laboratory. They are very cheap and come in various capacities and accuracies, from 1000 g ± 0.1 g to 20 g ± 0.001 g. I have bought a 1000 g ± 0.1 g one a while ago and I think they are the most common. All of them should come pre-calibrated, but you can't know if the calibration was accurate for sure. And because usually you don't have a set of calibration weights at home, you don't know how to do it yourself. It's actually quite simple, providing you have some spare change lying around.
My scale has an option for calibration that demands putting on a scale of declared weight from 1000 g down to 50 g in decrements of 50 g. After some calculations I decided that 100 g weight in coins is the best choice. You will soon understand why.

Using this simple brute-force formula in Mathematica I calculated all possible solutions for various weights:
Reduce[e2*8.5 + e1*7.5 + c50*7.8 + c20*5.74 + c10*4.1 +
    c5*3.92 + c2*3.06 + c1*2.3 == 100 && e2 >= 0 && e1 >= 0 &&
  c50 >= 0 && c20 >= 0 && c10 >= 0 && c5 >= 0 && c2 >= 0 &&
  c1 >= 0, {e2, e1, c50, c20, c10, c5, c2, c1}, Integers]
total weightpossible solutionsmin. number of coinsmax. number of coinsmin. value of coinsmax. value of coins
50 g1156200.29 €11.00 €
100 g467412410.57 €22.00 €
150 g5285818620.85 €33.00 €
200 g31847624830.97 €44.00 €
Note that the solution with minimum coins always has the maximum value, and vice versa.

As you can see the number of solutions increases greatly with each weight. It roughly follows an exponential power function[1] shown on the next plot.
Log-plot of possible solutions vs. total weight.
I think the optimal number of coins is about 30. If you'd want to use a larger number of coins it becomes more difficult to place them on the scale in time (the calibration time is limited, about 3 seconds) without any them falling off because you accidentally bumped a pile with your sausage fingers. A calibration with too few coins would be less accurate because every coin weight varies slightly from the declared weight.

Here are all of the solutions for 100 g total weight. You can download it and import in Excel or Mathematica or some other program if you want to play with it.
The solution with fewest coins and maxium value is the following:
10 × 2 €
2 × 1 €
Totaling 12 coins worth 22 €.

The solution with most coins and minimum value is the following:
1 × 10 c
1 × 5 c
3 × 2 c
36 × 1 c
Totaling 41 coins worth just 0.57 €.

And now for some statistics:
A comparison of coin weights by their values.
A comparison of total coins used in all solutions by their values.
You can clearly see the connection between the above plots. The lighter the coin, the more it will be used. No surprises here.
Also interesting are the distributions of the solutions.
Distribution of solutions by total number of coins used. It almost follows the normal distribution, but there is an unexplained shift of the peak to the left of the calculated distribution.
Distribution of solutions by total value of the solution. This one follows a Chi-square distribution instead of the normal distribution. Note that I've rounded the values to 10 cents for a better representation. The plot with original values can be seen here.
And here is my digital scale, freshly calibrated.
The combination is 11 × 10 c; 6 × 5 c; 8 × 2 c; 3 × 1c - the only one possible with the change from my wallet.
I hope you will find this useful and will calibrate your scales if you haven't already. And remember, it's best to use new coins straight from a bank. Dirt, oxides and scratches on the coins will cause an inaccurate calibration, especially with a more sensitive scale.

[1] The name is my own invention for functions of the type y = a^x^b since I couldn't find any information of this type of functions on the internet.