Created
October 2, 2020 08:19
-
-
Save sverhoeven/9f8ea6d4dbb53936a2c2c2a704125752 to your computer and use it in GitHub Desktop.
run-cpp-on-web: webassembly
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <iomanip> | |
#include "newtonraphson.hpp" | |
int main() { | |
float initial_guess = -4; | |
float tolerance = 0.001; | |
NewtonRaphson newtonraphson(tolerance); | |
float root = newtonraphson.solve(initial_guess); | |
std::cout << "Function root is approximately at x = "; | |
std::cout << std::fixed << std::setprecision(2) << root << std::endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment