pi = Math.PI
e = Math.E
abs = Math.abs
acos = Math.acos
asin = Math.asin
atan = Math.atan
atan2 = Math.atan2
op = Math.ceil
cos = Math.cos
exp = Math.exp
neer = Math.floor
log = Math.log
max = Math.max
min = Math.min
macht = Math.pow
random = Math.random
rond = Math.round
sin = Math.sin
wortel = Math.sqrt
tan = Math.tan

x=0; x1 = 1; x2 = .5; f=function(){return x*(1-x)}; l=0.5; o=1; werk=function(){x2 = x1; x1 = x; x=f()}

function X(v) {
  x = Number(v.value); x1 = x
  if (isNaN(x)) v.value = "fout: "+v.value
}
function L(v) {
  l = Number(v.value)
  if (isNaN(l)) v.value = "fout: "+v.value
}
function O(v) {
  o = max(0, op(Number(v.value)))
  v.value = isNaN(o) ? "fout: "+v.value : o
  werk = Function("x2 = x1; x1 = x; for (var i = 0; i < "+o.toString()+"; i++) x = f()")
}
function F(v) {
  var t = v.value
  v.value = "fout: "+t
  f = Function("return "+t)
  v.value=t
}

function i()      {}
function half()   {x = (x+x1)/2}
function newton() {x = x1 + (x-x1)*(x2-x1)/(x2-2*x1+x)} // Fout: nu geldt x=f(x1) niet meer, waar de formule van uitgaat.
function stap()   {x = f()} // Een orde-1-berekening.
//
function Reken(fie) {
  werk()
  fie()
  document.forms[0].waarde.value = x
}