[Scilab-users] Strange behavior of explicit vs implicit iteration

Federico Miyara fmiyara at fceia.unr.edu.ar
Mon Apr 25 10:00:08 CEST 2022


Dear All,

Here I have the following script, where I compute the same thing using 
two iteration methods:

alfa  =  rand(1,10);
Rpr  =  rand();
R  =  rand();
Z  =  rand(10,200);  

G  =  zeros(1,200);
for  i=1:200
    A  =  0;
    B  =  0;
    for  k  =  1:10
       A  =  A  +  Rpr*alfa(k)  /  (Z(k,i)  +  alfa(k)*(1  -  alfa(k))*R);   
       B  =  B  +  Rpr*(1  -  alfa(k))  /  (Z(k,i)  +  alfa(k)*(1  -  alfa(k))*R);
    end
    G(i)  =  (1  +  A)  /  (1  +  B);
end

A  =  1;
B  =  1;
for  k  =  1:10
    A  =  A  +  Rpr*alfa(k)  ./  (Z(k,:)  +  alfa(k)*(1  -  alfa(k))*R);   
    B  =  B  +  Rpr*(1  -  alfa(k))  ./  (Z(k,:)  +  alfa(k)*(1  -  alfa(k))*R);
end
G1  =  A  ./  B;

[M,  ind]  =  max(abs(G- G1))

However, the last line shows that there are differences between both 
methods. They are tiny (near %eps), but I can't find nor imagine which 
is the reason.

NOTE: I kept the original formulas as in the script where the problem 
arised but changed the data. When I tried to use a simpler formula there 
was no difference.

Any idea?

Regards,

Federico Miyara


-- 
El software de antivirus Avast ha analizado este correo electrónico en busca de virus.
https://www.avast.com/antivirus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20220425/264fa094/attachment.htm>


More information about the users mailing list