Skip to main content
Post Closed as "Duplicate" by vapor, Itai Seggev, LCarvalho, MarcoB, yohbs
added 2 characters in body
Source Link

I'm new to Mathematica and I'm trying to work with Do for a set of indexed objects in order to avoid doing the same action repeatedly. For example, I create the following lists:

dog[1] = {{1, 1}, {25, 17}, {3, 110}}; 
dog[2] = {{17, 2}, {211, 28}, {34, 23}};
dog[3] = {{1, 37}, {21, 35}, {39, 3}};

And I want to change the value of the second columns on each of these 10 times. My approach to the problem:

Do[Part[dog[i], All, 2] = 10*Part[Perro[i], All, 2], {i, 3}]

But it returns me the error: dog[i] in the part assignment is not a symbol. How can this be fixed? I would really appreciate your help.

I'm new to Mathematica and I'm trying to work with Do for a set of indexed objects in order to avoid doing the same action repeatedly. For example, I create the following lists:

dog[1] = {{1, 1}, {2, 1}, {3, 1}}; 
dog[2] = {{1, 2}, {2, 2}, {3, 2}};
dog[3] = {{1, 3}, {2, 3}, {3, 3}};

And I want to change the value of the second columns on each of these 10 times. My approach to the problem:

Do[Part[dog[i], All, 2] = 10*Part[Perro[i], All, 2], {i, 3}]

But it returns me the error: dog[i] in the part assignment is not a symbol. How can this be fixed? I would really appreciate your help.

I'm new to Mathematica and I'm trying to work with Do for a set of indexed objects in order to avoid doing the same action repeatedly. For example, I create the following lists:

dog[1] = {{1, 1}, {5, 7}, {3, 10}}; 
dog[2] = {{7, 2}, {11, 8}, {4, 3}};
dog[3] = {{1, 7}, {1, 5}, {9, 3}};

And I want to change the value of the second columns on each of these 10 times. My approach to the problem:

Do[Part[dog[i], All, 2] = 10*Part[Perro[i], All, 2], {i, 3}]

But it returns me the error: dog[i] in the part assignment is not a symbol. How can this be fixed? I would really appreciate your help.

Source Link

How to use loops with indexed objects?

I'm new to Mathematica and I'm trying to work with Do for a set of indexed objects in order to avoid doing the same action repeatedly. For example, I create the following lists:

dog[1] = {{1, 1}, {2, 1}, {3, 1}}; 
dog[2] = {{1, 2}, {2, 2}, {3, 2}};
dog[3] = {{1, 3}, {2, 3}, {3, 3}};

And I want to change the value of the second columns on each of these 10 times. My approach to the problem:

Do[Part[dog[i], All, 2] = 10*Part[Perro[i], All, 2], {i, 3}]

But it returns me the error: dog[i] in the part assignment is not a symbol. How can this be fixed? I would really appreciate your help.