Friday, October 21, 2022

Newton's Method

 //  Newton's Method

#include <iostream>

#include <math.h>

double f(double t){return t*t*t*t+t*t*t+t*t+t-9;}

double ff(double t) { return 4 * t * t * t + 3 * t * t + 2 * t + 1; }

int main()

{

    int N = 1000;

    double x=-100.;

    for (int i = 1; i < N; i++) { x = x - f(x) / ff(x); }

    std::cout << "Solution =" << x << "\n";

    return 0;

}

No comments:

Post a Comment

NaCl.xyz Generator with Interactive 3D Visualization

NaCl.xyz Generator with Interactive 3D Visualization NaCl.xyz Generator with Interactive 3D Visualization ...