Skip to main content
syntax highlight
Source Link
AsukaMinato
  • 10.4k
  • 1
  • 17
  • 44

Given a 3x3 matrix, check each of the columns starting from the first one, and if a column contains 1 or -1 the output is x, otherwise the output is y. Then list the sequence of these x,y as a vector. For example, let A={{2,1,1},{0,1,0},{0,0,1}}, then f is the vector where f(1)=y, f(2)=x, f(3)=x, according to the given matrix

I tried the following but it needs to be revised:

 For[k = 1, k <= 3, k++, For[z = 1, z <= 3, z++,  If[A[[z, k]] == 1 || A[[z, k]] == -1,  f[[k]] = y,  f[[k]] = x;  ];  ];  ]; f[[1]], f[[2]], f[[3]]

I also tried this one but in this version if a column has 1 then output is x otherwise the output is y For[k = 1, k <= 3, k++, If [A[[1, k]] == 1 || A[[2, k]] == 1 || A[[3, k]] == 1, f[[k]] = y, f[[k]] = x; ]; ];

For[k = 1, k <= 3, k++, If [A[[1, k]] == 1  || A[[2, k]] == 1 || A[[3, k]] == 1, f[[k]] = y,  f[[k]] = x; ]; ];

Given a 3x3 matrix, check each of the columns starting from the first one, and if a column contains 1 or -1 the output is x, otherwise the output is y. Then list the sequence of these x,y as a vector. For example, let A={{2,1,1},{0,1,0},{0,0,1}}, then f is the vector where f(1)=y, f(2)=x, f(3)=x, according to the given matrix

I tried the following but it needs to be revised:

 For[k = 1, k <= 3, k++, For[z = 1, z <= 3, z++,  If[A[[z, k]] == 1 || A[[z, k]] == -1,  f[[k]] = y,  f[[k]] = x;  ];  ];  ]; f[[1]], f[[2]], f[[3]]

I also tried this one but in this version if a column has 1 then output is x otherwise the output is y For[k = 1, k <= 3, k++, If [A[[1, k]] == 1 || A[[2, k]] == 1 || A[[3, k]] == 1, f[[k]] = y, f[[k]] = x; ]; ];

Given a 3x3 matrix, check each of the columns starting from the first one, and if a column contains 1 or -1 the output is x, otherwise the output is y. Then list the sequence of these x,y as a vector. For example, let A={{2,1,1},{0,1,0},{0,0,1}}, then f is the vector where f(1)=y, f(2)=x, f(3)=x, according to the given matrix

I tried the following but it needs to be revised:

 For[k = 1, k <= 3, k++, For[z = 1, z <= 3, z++,  If[A[[z, k]] == 1 || A[[z, k]] == -1,  f[[k]] = y,  f[[k]] = x;  ];  ];  ]; f[[1]], f[[2]], f[[3]]

I also tried this one but in this version if a column has 1 then output is x otherwise the output is y

For[k = 1, k <= 3, k++, If [A[[1, k]] == 1  || A[[2, k]] == 1 || A[[3, k]] == 1, f[[k]] = y,  f[[k]] = x; ]; ];
edited title
Link
user64494
  • 29.1k
  • 4
  • 29
  • 56

listing Listing according to constrainconstraint

added 23 characters in body
Source Link
gunes
  • 391
  • 1
  • 8

Given a 3x3 matrix, check each of the columns starting from the first one, and if a column contains 1 or -1 the output is x, otherwise the output is y. Then list the sequence of these x,y as a vector. For example, let A={{2,1,1},{0,1,0},{0,0,1}}, then f is the vector where f(1)=y, f(2)=x, f(3)=x, according to the given matrix

I tried the following but it needs to be revised:

 For[k = 1, k <= 3, k++, For[z = 1, z <= 3, z++,  If[A[[z, k]] == 1 || A[[z, k]] == -1,  f[[k]] = y,  f[[k]] = x;  ];  ];  ]; f[[1]], f[[2]], f[[3]]

I also tried this one but in this version if a column has 1 then output is x otherwise the output is y For[k = 1, k <= 3, k++, If [A[[1, k]] == 1 || A[[2, k]] == 1 || A[[3, k]] == 1, f[[k]] = y, f[[k]] = x; ]; ];

Given a 3x3 matrix, check each of the columns starting from the first one, and if a column contains 1 or -1 the output is x, otherwise the output is y. Then list the sequence of these x,y as a vector. For example, let A={{2,1,1},{0,1,0},{0,0,1}}, then f is the vector where f(1)=y, f(2)=x, f(3)=x, according to the given matrix

I tried the following but it needs to be revised:

 For[k = 1, k <= 3, k++, For[z = 1, z <= 3, z++,  If[A[[z, k]] == 1 || A[[z, k]] == -1,  f[[k]] = y,  f[[k]] = x;  ];  ];  ]; f[[1]], f[[2]], f[[3]]

Given a 3x3 matrix, check each of the columns starting from the first one, and if a column contains 1 or -1 the output is x, otherwise the output is y. Then list the sequence of these x,y as a vector. For example, let A={{2,1,1},{0,1,0},{0,0,1}}, then f is the vector where f(1)=y, f(2)=x, f(3)=x, according to the given matrix

I tried the following but it needs to be revised:

 For[k = 1, k <= 3, k++, For[z = 1, z <= 3, z++,  If[A[[z, k]] == 1 || A[[z, k]] == -1,  f[[k]] = y,  f[[k]] = x;  ];  ];  ]; f[[1]], f[[2]], f[[3]]

I also tried this one but in this version if a column has 1 then output is x otherwise the output is y For[k = 1, k <= 3, k++, If [A[[1, k]] == 1 || A[[2, k]] == 1 || A[[3, k]] == 1, f[[k]] = y, f[[k]] = x; ]; ];

added 23 characters in body
Source Link
gunes
  • 391
  • 1
  • 8
Loading
edited body
Source Link
gunes
  • 391
  • 1
  • 8
Loading
edited body
Source Link
gunes
  • 391
  • 1
  • 8
Loading
Source Link
gunes
  • 391
  • 1
  • 8
Loading