Created
October 2, 2020 09:36
-
-
Save sverhoeven/3cb247ea186c77f9b7ba83a2a909883f to your computer and use it in GitHub Desktop.
run-cpp-on-web: vega
This file contains 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
const initial_guess = -4; | |
const tolerance = 0.001; | |
const newtonraphson = new NewtonRaphson(tolerance); | |
newtonraphson.solve(initial_guess); | |
// newtonraphson.iterations is a vector object, which is not | |
// consumeable by Vega, so we need to convert Emscripten's | |
// vector of objects to a JavaScript array of objects first | |
const iterations = new Array( | |
newtonraphson.iterations.size() | |
).fill().map( | |
(_, iteration) => { | |
return newtonraphson.iterations.get(iteration) | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment