Maxima Function
newton (expr, x, x_0, eps)
Returns an approximate solution of expr = 0
by Newton's method,
considering expr to be a function of one variable, x.
The search begins with x = x_0
and proceeds until abs(expr) < eps
(with expr evaluated at the current value of x).
newton
allows undefined variables to appear in expr,
so long as the termination test abs(expr) < eps
evaluates
to true
or false
.
Thus it is not necessary that expr evaluate to a number.
load(newton1)
loads this function.
Examples:
(%i1) load (newton1); (%o1) /usr/share/maxima/5.10.0cvs/share/numeric/newton1.mac (%i2) newton (cos (u), u, 1, 1/100); (%o2) 1.570675277161251 (%i3) ev (cos (u), u = %); (%o3) 1.2104963335033528E-4 (%i4) assume (a > 0); (%o4) [a > 0] (%i5) newton (x^2 - a^2, x, a/2, a^2/100); (%o5) 1.00030487804878 a (%i6) ev (x^2 - a^2, x = %); 2 (%o6) 6.098490481853958E-4 a