From 00fab77412da2ad4304faa8227e7ccce8ee8139d Mon Sep 17 00:00:00 2001 From: Krishna Vedala <7001608+kvedala@users.noreply.github.com> Date: Fri, 19 Jun 2020 18:26:15 -0400 Subject: [PATCH] set epsilon to 1e-10 and update documentation --- numerical_methods/newton_raphson_method.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/numerical_methods/newton_raphson_method.cpp b/numerical_methods/newton_raphson_method.cpp index 45560e323..7597f1b8a 100644 --- a/numerical_methods/newton_raphson_method.cpp +++ b/numerical_methods/newton_raphson_method.cpp @@ -17,17 +17,24 @@ #include #include -#define EPSILON \ - std::numeric_limits::epsilon() ///< system accuracy limit -#define MAX_ITERATIONS 50000 ///< Maximum number of iterations to check +#define EPSILON 1e-10 ///< system accuracy limit +#define MAX_ITERATIONS INT16_MAX ///< Maximum number of iterations to check -/** define \f$f(x)\f$ to find root for +/** define \f$f(x)\f$ to find root for. + * Currently defined as: + * \f[ + * f(x) = x^3 - 4x - 9 + * \f] */ static double eq(double i) { return (std::pow(i, 3) - (4 * i) - 9); // original equation } /** define the derivative function \f$f'(x)\f$ + * For the current problem, it is: + * \f[ + * f'(x) = 3x^2 - 4 + * \f] */ static double eq_der(double i) { return ((3 * std::pow(i, 2)) - 4); // derivative of equation