|
Algorithms_in_C++ 1.0.0
Set of algorithms implemented in C++.
|
Solve the equation \(f(x)=0\) using Newton-Raphson method for both real and complex solutions. More...
#include <cmath>#include <ctime>#include <iostream>#include <limits>Functions | |
| static double | eq (double i) |
| static double | eq_der (double i) |
| int | main () |
Variables | |
| constexpr double | EPSILON = 1e-10 |
| system accuracy limit | |
| constexpr int16_t | MAX_ITERATIONS = INT16_MAX |
| Maximum number of iterations. | |
Solve the equation \(f(x)=0\) using Newton-Raphson method for both real and complex solutions.
The \((i+1)^\text{th}\) approximation is given by:
\[ x_{i+1} = x_i - \frac{f(x_i)}{f'(x_i)} \]
|
static |
|
static |
define the derivative function \(f'(x)\) For the current problem, it is:
\[ f'(x) = 3x^2 - 4 \]
| int main | ( | void | ) |
Main function