This is an example on how to use newton.
#include "../../Test.h"
#include <cmath>
#include <vector>
class NewtonTestCase : public Test
{
bool TestNewton() {
int maxIter = 100;
double TOL = 1e-16;
auto res =
newton(f, Df, x0, TOL, maxIter);
std::vector<double> xExpt = { 0.73908513321516067 };
for(int i = 0; i < 1; ++i) { AssertEqual(res.first(i, 0), xExpt[i]); }
return true;
}
public:
void run() override { TestNewton(); }
};
int main() { NewtonTestCase().run(); }
std::pair< Matrix< double >, int > newton(const LinearEquation &f, const Jacobian &Df, const Matrix< double > &x0, double TOL, int maxIter)
Definition: newton.h:32