As the question itself admits, there is no "true" mathematical answer to the question since the best tuning varies from piano to piano. But one can use a formula that includes a quadratic term to give some approximation of the Railsback curve. It is therefore probably a closer fit for most pianos than equal temperament would be.
Source: Original research. (I am an amateur musician with a math degree.) Corrections are welcome.
- Assumption #1: The octave around middle C (or C4) is roughly
equal-tempered.
- Assumption #2: Due to the inharmonicity of the
strings, each octave above or below middle C should be "stretched"
incrementally wider than the preceding octave.
Define a "stretch factor" s in semitones per octave. Then each note n, in semitones above middle C, should be tuned (s/2)(n/12)^2
semitones sharper than equal temperament (and each note below middle C flatter by the same amount).
For my piano, a stretch factor of s = 0.05 semitones (or 5 cents) seems to work well. In other words, the octave around C5 will be tuned 5 cents wider than equal temperament, the octave around C6 will be tuned 10 cents wider, and so on. Using the above formula, we find that each C above and below middle C should be tuned as follows:
C5: 2.5 cents sharp (5/2)
C6: 10 cents sharp (5 + 10/2)
C7: 22.5 cents sharp (5 + 10 + 15/2)
C8: 40 cents sharp (5 + 10 + 15 + 20/2)
Now how do we get actual frequencies from this?
In an equal-tempered tuning, the frequency of a note n is x = C4 * 2^(n/12)
Hz. Adding in our adjustment term, we get x = C4 * 2^((n + (s/2)(n/12)^2) / 12)
Hz. (Notes below middle C should be flat rather than sharp, so subtract the adjustment term rather than adding it.)
For concert pitch (A = 440 Hz), the correct frequency for middle C depends on the choice of stretch factor s. Substitute x = 440 Hz and n = 9 semitones in the above formula, then solve for C4. For s = 0.05, the correct frequency is 261.41 Hz.
Plugging that value for C4 back into the formula, we can then compute:
C1: 32.25 Hz (flatter than E.T. @ 32.70 Hz)
C2: 64.98 Hz (flatter than E.T. @ 65.41 Hz)
C3: 130.52 Hz (flatter than E.T. @ 130.81 Hz)
C4: 261.41 Hz (flatter than E.T. @ 261.63 Hz)
C5: 523.58 Hz (sharper than E.T. @ 523.25 Hz)
C6: 1051.71 Hz (sharper than E.T. @ 1046.50 Hz)
C7: 2118.66 Hz (sharper than E.T. @ 2093.00 Hz)
And so on.