You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description of the current behavior
The variable gets updated while the source value of the variable changes after the assignment of the variables
Description of the expected behavior
The variable should not change when the source value changes after it is assigned.
What web browser you are using
It is done in the Chrome browser
Additional context
Example to explain the bug
X = np.array([[-16.1718, 495.4491],
[-139.3684, 397.6613],
[81.1637, -201.7584],
[59.0297, -308.5572],
[45.7631, -392.7569]]) # Initializing the array
print(X) # Printing the array
Fk=X[2,:] # Initialze a new variable Fk with X[2,:]
print('Fk=',Fk) # Printing the variable Fk
vv=[320, 500] # Initialize a new variable vv
X[2,:]=vv+X[2,:] # Updating the X[2,:]
print('X=',X) # printing the variable X
print('Fk=',Fk) # Printing the variable Fk
The X is initialized with some values. FK variable is initialized with the 2nd element of the X array (X[2,:]). Later, X[2,:] is updated with the new value of the sum of X[2,:] + vv. This update makes changes in X and Fk. However, the X[2,:] is assigned to Fk before updating the value of X[2,:]. It is expected that Fk shouldn't get changed while updating the value X[2,:].
The text was updated successfully, but these errors were encountered:
Description of the current behavior
The variable gets updated while the source value of the variable changes after the assignment of the variables
Description of the expected behavior
The variable should not change when the source value changes after it is assigned.
What web browser you are using
It is done in the Chrome browser
Additional context
Example to explain the bug
X = np.array([[-16.1718, 495.4491],
[-139.3684, 397.6613],
[81.1637, -201.7584],
[59.0297, -308.5572],
[45.7631, -392.7569]]) # Initializing the array
print(X) # Printing the array
Fk=X[2,:] # Initialze a new variable Fk with X[2,:]
print('Fk=',Fk) # Printing the variable Fk
vv=[320, 500] # Initialize a new variable vv
X[2,:]=vv+X[2,:] # Updating the X[2,:]
print('X=',X) # printing the variable X
print('Fk=',Fk) # Printing the variable Fk
Output:
X= [[ -16.1718 495.4491]
[-139.3684 397.6613]
[ 81.1637 -201.7584]
[ 59.0297 -308.5572]
[ 45.7631 -392.7569]]
Fk= [ 81.1637 -201.7584]
X= [[ -16.1718 495.4491]
[-139.3684 397.6613]
[ 401.1637 298.2416]
[ 59.0297 -308.5572]
[ 45.7631 -392.7569]]
Fk= [401.1637 298.2416]
The X is initialized with some values. FK variable is initialized with the 2nd element of the X array (X[2,:]). Later, X[2,:] is updated with the new value of the sum of X[2,:] + vv. This update makes changes in X and Fk. However, the X[2,:] is assigned to Fk before updating the value of X[2,:]. It is expected that Fk shouldn't get changed while updating the value X[2,:].
The text was updated successfully, but these errors were encountered: