module Numerics.FindRoot (newtonStep) where
newtonStep
:: Double
-> (Double -> Double)
-> Double
-> Double
newtonStep :: Double -> (Double -> Double) -> Double -> Double
newtonStep Double
h Double -> Double
f Double
t = Double
t Double -> Double -> Double
forall a. Num a => a -> a -> a
- Double -> Double
f Double
t Double -> Double -> Double
forall a. Fractional a => a -> a -> a
/ Double -> (Double -> Double) -> Double -> Double
d Double
h Double -> Double
f Double
t
d :: Double
-> (Double -> Double)
-> Double
-> Double
d :: Double -> (Double -> Double) -> Double -> Double
d Double
h Double -> Double
f Double
t = (Double -> Double
f (Double
tDouble -> Double -> Double
forall a. Num a => a -> a -> a
+Double
h) Double -> Double -> Double
forall a. Num a => a -> a -> a
- Double -> Double
f Double
t) Double -> Double -> Double
forall a. Fractional a => a -> a -> a
/ Double
h