Is there a Newton-Raphson method for finding the zeros of scalar functions of several variables?

109 Views Asked by At

I have seen countless examples of using the Newton-Raphson method to find the roots of a system of equations. But I cannot find anything on the possibility of finding the zeros of a scalar function of multiple variables with a similar approach.

As an example, suppose we try to find the zeros of

$$f(x,y) = -x^2 - y^2 + C $$

The solution is a curve (circle), instead of a point. Is there anything similar to Newton-Raphson to approach the solution numerically?

enter image description here

1

There are 1 best solutions below

0
On BEST ANSWER

Following the suggestions from some of the comments to my question, we can solve for all the $x$ values by using the standard Newton-Raphson method for each $y$ value.

I leave some Matlab code that does this

C     = 1;
fun   = @(x,y,C) -(x.^2+y.^2-C); % f(x,y)
funp  = @(x) -2*x;               % f'(x,y)
tol   = 1e-6;
ys    = (-1.25:0.01:1.25)';      % y grid
xx    = 0.2*ones(size(ys));      % x grid
I     = 100;
diff  = NaN(numel(ys),I);
for j=1:I
    xprime    = xx - fun(xx,ys,C)./funp(xx);
    diff(:,j) = abs(xprime-xx);
    xx        = xprime;
    % Some x values may not satisfy f(x,y)=0  - depends on how you define your x,y grid
    if max(diff(:,j))<tol   
        disp('Converged')
        break
    end
end