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

Ezequiel Soule ezequielsoule at gmail.com
Tue Jan 29 16:52:27 CET 2013


Hi Rafael, thank you for your answer.
I'm running the code with the minimum variables required for it 
(positions, radius, number of spheres).
it can be some sort of error generating in the output (or in some 
internal calculation) of calc_D_superp_dobcel, but I don't think it is 
roundoff, why would that change when defining a different variable or 
adding a command with no connection? superp0 and superp1, as you told me 
to define them, are the same (superp0-superp1=0), so the error is not 
produced in those lines, it is something less direct. I'm not expert, 
but I guess what is happenning here is that, using a section of the RAM, 
the stack, the space where variables are stored, or whatever it is, is 
sligthly modifying OTHER sections of the RAM or wathever. Some bug of 
scilab, or maybe it is a common thing in every program but usually goes 
unnoticed (which would be understandable, it is a 1e-15 error, most of 
the times it will be not significant).
Right after writting this, and remembering some issues like the division 
by zero... I had an idea (is "epiphany" too pretencious?), and I ran it 
on ubuntu... the problem is gone! There is no error under ubuntu. So the 
problem is in Windows (it is Windows server, I can check Windows Vista 
in a few days...). the question is: Is it a Windows bug, or a 
Scilab-for-Windows bug?
By the way, the obvious solution for me would not work. I cannot run my 
simulations in my ubuntu machine, we have the workstation for large 
calculations so we don't overload our personal computers, and the 
worstations runs with Windows server... Well, I can test my control 
system in my ubuntu machine, but not run the real thing...



On 28/01/13 21:50, Rafael Guerra wrote:
>  From the code excerpt provided it is difficult to see from where errors of
> magnitude~=1e-15 might come from.
>
> Could they be due to some round-off errors in the function:
> calc_D_superp_dobcel? Please check the function details.
>
> Have you run the code with a "clear" at the beginning of the program to
> clean all variables?
>
> // Could you please define before your 3rd control system:
>     superp0= superp;
> // and after your 3rd control system:
>     superp1= superp;
>     printf("%i...delta(superp) = %e", control, max(abs(superp1-superp0)) )
> // and tell us what values do you get? Do the errors of 1e-15 magnitude
> occur and at which "control" iterations?
>
>
> // Non related to your problem, herebelow are some suggestions, if you will,
> to make your code more easy to read:
>
>     //define additional variables to simplify the code:
>     m = int(control/max_mov*20);
>     N = length(sup_2);
>     s = sum(superp);
>
>     // write:
>     while max(superp)>tol & control<=max_mov // moving "control=control+1" to
> the end of the while loop
>
>
> PS: "sumsupant"  // this variable is not defined in the code excerpt, looks
> like =sum(superp)
>
>
> Regards,
> Rafael G.
>
>
>
> --
> View this message in context: http://mailinglists.scilab.org/modifying-a-variable-changes-the-value-of-another-variable-tp4025762p4025819.html
> Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com.
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users




More information about the users mailing list