0
$\begingroup$

How can we apply a duty on elements of vectors but they remain unchanged for the next processes:

For instance we have a process governed by these lines. However, in one loop process some elements of Ai's replace by zero (if they equal to 1) but in the start of the next loop, we must have the same Ai as the first of the previous loop (original Ai).

Subscript[A, 1] = {{0}, {0}}; Subscript[A, 2] = {{0}, {1}};
Subscript[A, 3] = {{1}, {0}}; Subscript[A, 4] = {{1}, {1}};

Do[
 Do[
   Do[
    If[
           Subscript[A, i][[j]] = Subscript[A, i][[j + 1]] == 1,,
               Subscript[A, i][[j]] = Subscript[A, i][[j + 1]] = 0; 
               matrix[[k, i]] += delta[Subscript[A, k], Subscript[A, i]]; 

     ],
      {j, 1, nn - 1}]
   , {i, 1, 2^nn}
   ]
, {l, 1, 2^nn}]

Prevent to being more ambiguous, matrix is not important to be shown.

$\endgroup$
  • $\begingroup$ If the answer below answered your questions, please accept it by clicking the grey arrow! $\endgroup$ – march Jun 22 '15 at 14:49
  • $\begingroup$ @march, By the way, your comment about change all variables with subscripts to variables such as v[i] with no subscripts, has so helped me. Thanks a bunch for those comments. $\endgroup$ – Unbelievable Jun 23 '15 at 16:52
2
$\begingroup$

You're code does not run but I think I understand what you are trying to do. You can make use of Module to make copies of the $A_i$ for use in the calculation.

If[Subscript[A, i][[j]] = Subscript[A, i][[j + 1]] == 1,
 ,
 Module[{a = Subscript[A, i]}, 
  a[[j]] = a[[j + 1]] = 0;
  matrix[[k, i]] += delta[Subscript[A, k], a];]
 ]

a is manipulated leaving $A_i$ untouched.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.