[Maxima] teaching code for newton2
LindnerW at t-online.de
Thu Apr 5 14:25:00 CDT 2007
"Robert Dodier" <robert.dodier at gmail.com> schrieb:
> Here's an attempted rewrite.
> numer : true;
> f(ax) := [sin(ax[1,1]*ax[2,1]), ax[1,1] - 2];
> J(ax) := ''(matrix (diff (f(ax), ax[1,1]), diff (f(ax), ax[2,1])));
> ax : matrix ([1.5], [1.5]);
> for i:1 thru 100 do ax : ax + J(ax)^^(-1).(- f(ax));
in thinking about your code I must confess that it is with some 'raffinesse' and
Using one variable ax and splitting it in parts, good idea. But I ask myself: why does
Robert use _double_ indexing ax[2,1] etc., i.e. a mathematical matrix construct?
I hear my students asking: why is it not sufficent to use _single_ indices, i.e. vectors?
So I tried the following:
numer : true;
f(X) := [sin(X*X), X - 2];
J(X) := ''(matrix (diff (f(X), X), diff (f(X), X)));
X : matrix ([1.5,1.5]);
/* X : matrix ([1.5], [1.5]); worked neither */
for i:1 thru 100 do X : X + J(X)^^(-1).(- f(X));
.. and it does _not_ work. Surely you have known this beforehand.
Please, what is the rationale behind the fix using double indexing?
It would be nice if someone could elaborate a little bit about it.
More information about the Maxima