dear maxima experts,
making my first steps into Maxima I want to translate A. Pinkus YaCAS-Code for 2-dim
Newton-Iteration. Here is the original YaCAS-Code from the file Algo.Book.pdf S.18 (3.9
Newton iteration) of the YaCAS 1.063 distribution:
>> f(a,x):={Sin(a*x),a-2}
>> matrix(a,x):=Eval({D(a)f(a,x),D(x)f(a,x)})
>> {a,x}:={1.5,1.5}
>> For(ii:=1,ii<100,ii++)[{a,x}:={a,x}+ N(SolveMatrix(matrix(a,x),-f(a,x)));]
>> {a,x}
/ \
| 2. |
| |
| 0.596673098e-1 |
\ /
And here is my beginner's translation to Maxima (yes, I know of mnewton.mac and
newton1.mac) searching for a very simple version of newton. But I get stuck.
numer : true;
f(a,x) := matrix([Sin(a*x)],[a-2]);
J(a,x) : =matrix(''diff(f(a,x),a),''diff(f(a,x),x));
/* What is wrong with the following line? */
[a,x]: [1.5,1.5];
/*
How to manage the following line?
[a,x] is type list I think, the product is type matrix.
So I have to coerce it someway - but how?
*/
for i:1 thru 100 do ( [a,x] : [a,x] + J(a,x)^^(-1).(-f(a,x)) );
[a,x];
Sorry if my question is too simple, but it would be nice if someone could help me.
The wxMaxima sheet ist attached.
Thanks Wolfgang
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Newton2.wxm
Type: application/octet-stream
Size: 968 bytes
Desc: not available
Url : http://www.math.utexas.edu/pipermail/maxima/attachments/20070405/54a14d9f/attachment.obj