% CP5p19.m
% Computer problem 5.19 on p. 252 of Heath.
% Using multidimensional Newton method to find roots.
% Functions required: fcnCP5p19 (to compute function vector),
%                     fcnJCP5p19 (to compute Jacobian matrix),
%                     NewtonD04 (multidimensional Newton method).
% K. Ming Leung, 03/28/04

clear; format long;
tol = 1e-6; % tolerance
maxIt = 20; % maximum number of iterations
% Input model parameters:
gamma = 5;
delta = 1;

% Starting guess [1;2] converges to [0;1]
x = NewtonD04('fcnCP5p19','fcnJCP5p19',[1;2],tol,maxIt,gamma,delta),  

% Starting guess [1;-2] converges to [0;-1]
x = NewtonD04('fcnCP5p19','fcnJCP5p19',[1;-2],tol,maxIt,gamma,delta),  

% Starting guess [2;0] converges to [3.75;0.25]
x = NewtonD04('fcnCP5p19','fcnJCP5p19',[2;0],tol,maxIt,gamma,delta),  