[Scilab-users] modifying a variable changes the value of another variable!!!

Ezequiel Soule ezequielsoule at gmail.com
Mon Jan 28 13:14:01 CET 2013


Hello, I am using some iterative algorithm defined as a function in a .sci file, and I have the following problem: the iterations in the algorithm are controlled by a given variable. Now, if I define another variable, (which DO NOT affect the values of the control variable nor the way it is calculated) in the function, the number of iterations to converge changes! What happens is that the value of the control variable, for some reason, is modified. It is not a very significant modification, actually the difference is in the order of 10^-15... the problem is that this difference propagates exponentially as the iterations advance, and the total number of iterations and the final result (which is not unique) can be modified drastically!
My question is, why the value of the control variable is modifyied by the definition a completely independent variable. I saw this problem in scilab 5.4.0 and 5.2.2. I also had a similar, but worse, problem, before with a similar algorithm. I just added a command "pause" in the function, and this command was even OUTSIDE the while loop that defined the iterations... and the number of iterations was modyfied. How can this happen?




More information about the users mailing list