Implementing the derivative in C/C++

前端 未结 8 1245
旧时难觅i
旧时难觅i 2020-12-04 17:09

How is the derivative of a f(x) typically calculated programmatically to ensure maximum accuracy?

I am implementing the Newton-Raphson method, and it re

8条回答
  •  没有蜡笔的小新
    2020-12-04 17:43

    In addition to John D. Cooks answer above it is important not only to take into account the floating point precision, but also the robustness of the function f(x). For instance, in finance, it is a common case that f(x) is actually a Monte Carlo-simulation and the value of f(x) has some noise. Using a very small step size can in these cases severely degrade the accuracy of the derivative.

提交回复
热议问题