Here's a little Haskell code to calculate fret positions. With a 35" scale, at the 12th fret this yeilds either 17.50000 if using the rule' function, or 17.50501 using the rule function with its 17.81 approximation.
1 module Main( main ) where 2 3 import System( getArgs ) 4 5 main = do 6 args <- getArgs 7 print $ posAndOffsets ( parseDouble $ head args ) 24 8 9 parseInt :: String -> Int 10 parseInt x = fst $ head ( reads x :: [(Int, String)] ) 11 12 parseDouble :: String -> Double 13 parseDouble x = fst $ head ( reads x :: [(Double, String)] ) 14 15 posAndOffsets :: Double -> Int -> [(Int,Double)] 16 posAndOffsets s y = zip [0..y] (reverse (offsets s y)) 17 18 offsets :: Double -> Int -> [Double] 19 offsets _ 0 = [0.0] 20 offsets s y = [(head rest) + rule' (s - head rest)] ++ rest 21 where rest = offsets s (y-1) 22 23 rule :: Double -> Double 24 rule x = x / 17.81 25 26 rule' :: Double -> Double 27 rule' x = x / divisor 28 where divisor = 2 ** (1.0/12.0) / (2 ** (1.0/12.0) - 1) 29