Created
March 10, 2015 21:27
-
-
Save camisetags/ff17458cbc43064a8ea7 to your computer and use it in GitHub Desktop.
euler.js
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>25.6</title> | |
<script> | |
var xi = 0, | |
xf = 4, | |
x = xi, | |
y = 1; | |
var dx = 0.5; | |
var nc = (xf - xi)/dx; | |
console.log(x, y); | |
function f(x, y, dx, i){ | |
if ( i <= nc ) { | |
var dydx = (-2 * Math.pow(x, 3)) + (12 * Math.pow(x, 2)) - (20 * x) + 8.5; | |
y = y + dydx * dx; | |
x = x + dx; | |
console.log(x, y); | |
i++; | |
return f(x, y, dx, i); | |
} | |
} | |
f(x, y, dx, i = 0); | |
</script> | |
</head> | |
<body> | |
<h1>Abra o terminal</h1> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment