Question Math of a Non Linear Semi Whole Tone of a Musical Scale Intervals as Rationals Peculiar Question Irregular semi-tone of scale.  Hi folks, am hoping to achieve a formula
or function that can be applied to the general following problem - any feedback appreciated ;
Given two values that are known ;
(A) Fundamental = 1.07
(B) Some note = 1.4437
Where both (A) and (B) are the rational numeric values representing two musical intervals
occurring within the same 7 note musical scale.  In many cases where (A) and or (B) do not
represent standard values of known musical intervals the only way both values may occur
in a musical scale is to modify the values of the semitone and whole tone.
For example, if the standard values of the semitone and whole tone are applied to the production
of a scale based on the given fundamental (A) ; 1.07 we can see that the value for (B) does not appear
precisely on either a major or minor scale only an approximation.
Where standard values are used  ;
semitone = 1.059....
wholetone = 1.125 ....
Given input numbers, return the major_scale and minor_scale arrays.
This is done according to the rules:
MAJOR SCALE  W-W-H-W-W-W-H
MINOR SCALE  W-H-W-W-H-W-W
major_semitones = [0, 2, 4, 5, 7, 9, 11]    # Cummulating sum of W-W-H-W-W-W-H
minor_semitones = [0, 2, 3, 5, 7, 8, 10]    # Cummulating sum of W-H-W-W-H-W-W

Scales based on standard semitone, wholetone values fail to return the proper value of
(B) ;
[b]MAJOR MUSICAL SCALE FOR ( C# ) IS ;[/b]
C#        Eb        F          F#        Ab        Bb        C
1.0700  1.2010  1.3481  1.4283  1.6032  1.7995  1.0099
[b]MINOR MUSICAL SCALE FOR ( C# ) IS ;[/b]
C#        Eb        E          F#        Ab        A          B#
1.0700  1.2010  1.2725  1.4283  1.6032  1.6985  1.9065
THE QUESTION IS ; How can modified values for non-standard semitone and whole tone
be derived that provide the "best fit" for (A) and (B) to occur within the same scale?
In this example the correct modified values for irregular semitone and whole tone values
which produce a music scale where both (A) and (B) occur are ;
WHL TONE = 1.127844
SMI TONE = 1.062
The resulting scale yields (B) at the position of the tritone ;
W    1.07
W    1.20679308
H    1.361074335
W    1.445460943
W    1.630254452
W    1.838672702
H    1.036867988
But how can we derive via a standard formula ;
WHL TONE = 1.127844
SMI TONE = 1.062
When only given (A) and (B) ?
 A: I'm assuming from the way you phrase your question, that your whole tone is always exactly twice a semitone.
In general you will only be able to get an approximation, in the sense that 5 whole tones and 2 semitones (or 12 semitones) never exactly add up to an octave ($\;2\;$).  The best approximation to equal temperament tuning will be $$
n = [12 \log_2(B/A)] \\
H = (B/A)^{\tfrac 1 n} \\
W = H^2 \\
$$ where $\;[\dots]\;$ is rounding to the nearest integer.
This always makes $\;A H^n = B\;$, by design: in essence your question was really simply, "How can I find an $\;H\;$ so that multiplying $\;A\;$ by it a couple of times, I get exactly $\;B\;$?"
(Also, if rounding were removed, the result would always be exactly $\;H = 2^{\tfrac 1 {12}}\;$, the equal temperament semitone.)
The above gives you a semitone $\;H\;$ that is $\;1200 \log_2 H - 100\;$ cents off of an equal temperament semitone.
In your specific example of $\;A = 1.07\;$ and $\;B = 1.4437\;$ this gives $\;n=5\;$ semitones (so the interval that 'is' $\;B\;$ is the fourth, not the tritone) with $\;H=1.061741\dots\;$ and $\;W=1.127294\dots\;$, where $\;H\;$ is almost 4 cents too large, and the octave is almost 45 cents too large.
