John has just bought himself a guitar. Before he can start playing the instrument, he first must make sure it is "in tune" - that is, to make sure that all strings produce the correct frequencies when plucked. John has also bought an electric guitar tuner to help him with his. He plucks a string to produce a sound, which the tuner listens to and tells him that the actual note is too flat. John turns a knob on the guitar which tightens the string and he plucks it again, this time producing a higher frequency that the tuner says is properly in-tune. So what is happening here?
Let's remind ourselves for a moment why a vibrating string would produce a sound at all. Sound comes from Pressure Waves, created by some oscillating source which "pushes" air particles around it. Just like pushing water in a pool, this creates a pressure wave which can travel from the source through air. Your ear then interprets these pressure waves as sounds, with closer-together waves sounding "higher" and further-spaced waves sounding "lower".
Longer, heavier, and looser strings vibrate more slowly.
Shorter, lighter, and tighter strings vibrate more rapidly.
For a string which is firmly affixed on either end but allowed to vibrate freely otherwise, there are few ways in which we could make the string vibrate with a greater frequency, thereby increasing the pitch of the sound produced. We could increase the tension on the string, so that when it is displaced by a "pluck" the force of the tension will attempt to snap it back faster in the opposite direction. We could also decrease the length of the string to achieve a similar effect, which is why pressing the string into the guitar's fretboard will produce different notes. We could also use a string weighing less, so that it the force of the tension will have a greater effect on a lighter string.
These properties are related by the following equation:
$$ \huge f = \frac{1}{2 L} \sqrt{ \frac{T}{\mu} } $$
Where
f is the frequency of the tone produced by the string when plucked, in HertzL is the length of the string, in centimetersT is the tension on the string, in Newtonsµ (mu) is the mass per length of the string, in grams / meterNote that this is a somewhat idealized model, ignoring effects of elasticity and other factors.
John is continuing to tune his guitar. His tuner is configured such that A4 = 440 Hz,
and all other notes are calculated using an Equally-Tempered system. He plucks a string,
which the tuner says deviates from the desired note N by some amount.
Given the string having length L, mass per length µ, and initial tension T0, what
is the new tension that the string must be adjusted to in order to produce the desired note?
Input Data
First line will be Q, the quantity of testcases.
Q lines will then follow, each with 3 space-separated values in the format N L µ T0.
Answer
Should consist of Q space-separated values, being the new tension the string must be
to produce the desired note.
Error should be less than 1e-6
Example
input data:
2
A2 56.789 4.567 76.543
Bb4 65.432 12.345 67.890
answer:
71.286093 4594.185163
A few extra notes for this problem... The given values of L, µ, and T0 are all somewhat realistic
values for guitar strings, and the given value N is within a typical guitar's range. However
tightening actual strings to the extreme tensions in some answer values may cause them to snap,
due to overcompensation for poorly-chosen string weights.