Begin by putting in the function, if you have it. (a function of x)

For the Euler/Runge-Kutta simulation techniques, you only need to know the derivative of the function, dy/dx. (a function of x and y)

You need to know the initial x value, and y value , to the final x value .

In order to adjust the accuracy of the function estimation, you specificy a "step size" .

Sometimes you might like to use a very small step size, but only print the results every two steps, for example. Set the interval:

How to enter functions in code

Expressions are only groupable in parenthesis; math functions are from JavaScript; roots cannot be negative; exponents are carried out with a function. This is impossible to understand, so in other words:

power
23 changes to Math.pow(2, 3)
multiplication
3x changes to 3 * x; also, factors, like (a + b)(a - b) must be written as (a + b) * (a - b). It is easy to do once you write your function--put in the multiplication signs * between factors after you finish the rest, and then the euler/rk4 part is easy to use..
arithmetic
1 + 5 - 12 / 6. answer / 12. write this as ans = 1 + 5 - 12 / 6; answer / 12.
finishing
When you have created your function, you need to add the last step--return. For example, y = 2*x - 10; return y;

Math functions

ex
Math.exp(x)
sin(x), cos(x), tan(x)
Math.sin(x), Math.cos(x), Math.tan(x)

Since you can't take negative roots, (even to odd powers), you must do something like this: instead of writing -11/3 = Math.pow(-1, 1/3), you write -Math.pow(-(-1), 1/3) = -Math.pow(1, 1/3). For variables you could do this:

if (x < 0) ans = -Math.pow(-x, 1/3);
else ans = Math.pow(x, 1/3);