mnewton divide by zero



Edwin Woollett a ?crit :
> lisp error message with mnewton:
>
> (%i18) eqns  :  [ x + y = 3,  x^2 + y^2 = 9 ]$
> (%i19) mn(x1, x2) := mnewton( eqns, [x, y], [x1, x2] )$
> (%i20) solve( eqns, [x, y] );
> (%o20)                 [[x = 3, y = 0], [x = 0, y = 3]]
> (%i21) mn(1, 2);
> (%o21)                  [ [x = 6.37714165E-17, y = 3.0] ]
> ......
> (%i24) mn(0, 0);
> Maxima encountered a Lisp error:
>
>  Error in FUNCALL [or a callee]: Zero divisor.
>
> Automatically continuing.
> To reenable the Lisp debugger set *debugger-hook* to nil.
> (%i25) mn(0, 1);
> (%o25)                  [ [x = 1.13978659E-16,  y = 3.0] ]
>
> Is this a bug?
>   
In my opinion, this is not a bug but a feature of Newton's method. The 
same thing happens for 1-dimensional case :

load(newton1);
newton(cos(x),x,0,10^-7);    -------->  Division by 0

The principle of Newton's method is to take the intersection point of 
the x-axis with the tangent at starting point and iterate. But if the 
starting point has an horizontal tangent, a division by zero occurs. So 
it is your responsability to start from a point where the derivative (or 
partial derivatives) is not zero. You could modify your starting point 
by a small random number for instance.
But there is no guarantee of convergence anyway in general.

Eric Reyssat


> Ted Woollett
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>
>