Thiele's interpolation formula: Difference between revisions
→{{header|Haskell}}: 100 -> 1000 (+ updated outputs)
(→{{header|Haskell}}: hlint, hindent + a couple of reductions) |
(→{{header|Haskell}}: 100 -> 1000 (+ updated outputs)) |
||
Line 523:
-- Inverted interpolation function of f
invInterp :: (Double -> Double) -> [Double] -> Double -> Double
invInterp f xs = thiele (
main :: IO ()
Line 536:
[inv_sin, inv_cos, inv_tan] =
uncurry ((. div_pi) . invInterp) <$>
[(sin, (2, 31)), (cos, (2, 100)), (tan, (4,
-- N points taken uniformly from 0 to Pi/d
div_pi (d, n) = (* (pi / (d * n))) <$> [0 .. n]</lang>
Line 542:
<pre>3.141592653589795
3.141592653589791
3.
=={{header|J}}==
|