
/* newton.q: compute roots of a function with Newton's method */

newton DX DY F	= until (satis DY F) (improve DX F);
satis DY F X	= abs (F X) < DY;
improve DX F X	= X - F X / derive DX F X;
derive DX F X	= (F (X+DX) - F X) / DX;
