package gsl

  1. Overview
  2. Docs

Numerical Differentiation

val central : f:(float -> float) -> x:float -> h:float -> Fun.result

central f x h computes the numerical derivative of the function f at the point x using an adaptive central difference algorithm with a step-size of h. The function returns a value r with the derivative being in r.res and an estimate of its absolute error in r.err.

val forward : f:(float -> float) -> x:float -> h:float -> Fun.result

forward f x h computes the numerical derivative of the function f at the point x using an adaptive forward difference algorithm with a step-size of h. The function is evaluated only at points greater than x, and never at x itself. The function returns r with the derivative in r.res and an estimate of its absolute in r.err. This function should be used if f(x) has a discontinuity at x, or is undefined for values less than x.

val backward : f:(float -> float) -> x:float -> h:float -> Fun.result

forward f x h computes the numerical derivative of the function f at the point x using an adaptive backward difference algorithm with a step-size of h. The function is evaluated only at points less than x, and never at x itself. The function returns a value r with the derivative in r.res and an estimate of its absolute error in r.err. This function should be used if f(x) has a discontinuity at x, or is undefined for values greater than x.

OCaml

Innovation. Community. Security.