pluton
unread,Feb 8, 2012, 3:02:35 AM2/8/12You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
Hi,
I have the following code for a fixed point iteration in two dimensions:
Restart; with(linalg);
Gt:=matrix(2,1,[2-2*x2,1/2*sqrt((2-x1)*(2+x1))]);
#Maple command to get a vector as a function of x1 and x2;
G:=array@op@unapply([op](eval(Gt)),x1,x2):
# initial quantities
X0:=matrix(2,1,[0.5,0.5]);epsilon:=1e-12;Nor:=2;i:=1;
# loop
while Nor > epsilon do
X1:=G(X0[1,1],X0[2,1]);
Y:=evalm(X1-X0);
N:=evalm(transpose(Y)&*(Y));
Nor:=evalf(sqrt(N[1,1]));
X0:=X1;
i:=i+1;
end do:
If you run this, you'll see that from the second iteration, X0 and X1 are identical and I do not know why? It means that when X1:=G(X0[1,1],X0[2,1]); is performed (in loop 2) X0 gets the value of X1 right away and Y is then 0 and the procedure stops while it should not. I think there is some kind of a tricky thing happening inside Maple (13) but I am not sure what. I'd be happy to have your insight. Thanks