No BSD License  

Highlights from
Numerical Methods for Physics

from Numerical Methods for Physics by Alejandro Garcia
Companion Software

FNewt(x,a)
function [f,D] = FNewt(x,a)
%  Function used by the N-variable Newton's method
%  The variable a is a parameter
%  Lorenz model x=[x y z], a=[r sigma b]
f(1) = a(2)*(x(2)-x(1));
f(2) = a(1)*x(1)-x(2)-x(1)*x(3);
f(3) = x(1)*x(2)-a(3)*x(3);
D(1,1) = -a(2);        % df(1)/dx(1)
D(1,2) = a(1)-x(3);    % df(2)/dx(1)
D(1,3) = x(2);         % df(3)/dx(1)
D(2,1) = a(2);         % df(1)/dx(2)
D(2,2) = -1;           % df(2)/dx(2)
D(2,3) = x(1);         % df(3)/dx(2)
D(3,1) = 0;            % df(1)/dx(3)
D(3,2) = -x(1);        % df(2)/dx(3)
D(3,3) = -a(3);        % df(3)/dx(3)
return;

Contact us at files@mathworks.com