Not able to drop columns in a matrix using Drop [closed]

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
3
down vote

favorite












 R= (1/2 Cos[b z1] - 1/2 Cos[b z1] Cos[t]) Sin[b (L - z1)] + 
Cosh[b (L - z1)] (-(1/2) Sin[b z1] - 1/2 Cos[t] Sin[b z1]) +
Cos[b (L - z1)] (1/2 Sin[b z1] -
1/2 Cos[t] Sin[b z1]) + (1/2 Cos[b z1] +
1/2 Cos[b z1] Cos[t]) Sinh[b (L - z1)],
Cos[b (L - z1)] (1/2 Cos[b z1] -
1/2 Cos[b z1] Cos[t]) + (-(1/2) Cos[b z1] -
1/2 Cos[b z1] Cos[t]) Cosh[b (L - z1)] +
Sin[b (L - z1)] (-(1/2) Sin[b z1] +
1/2 Cos[t] Sin[b z1]) + (-(1/2) Sin[b z1] -
1/2 Cos[t] Sin[b z1]) Sinh[
b (L - z1)], (1/2 Cosh[b z1] + 1/2 Cos[t] Cosh[b z1]) Sin[
b (L - z1)] + (1/2 Cosh[b z1] - 1/2 Cos[t/2]^2 Cosh[b z1] +
1/2 Cosh[b z1] Sin[t/2]^2) Sinh[b (L - z1)] +
Cos[b (L - z1)] (-(1/2) Sinh[b z1] - 1/2 Cos[t] Sinh[b z1]) +
Cosh[b (L - z1)] (1/2 Sinh[b z1] - 1/2 Cos[t] Sinh[b z1]),
Cos[b (L - z1)] (-(1/2) Cosh[b z1] - 1/2 Cos[t] Cosh[b z1]) +
Cosh[b (L - z1)] (1/2 Cosh[b z1] - 1/2 Cos[t] Cosh[b z1]) +
Sin[b (L - z1)] (1/2 Sinh[b z1] + 1/2 Cos[t] Sinh[b z1]) +
Sinh[b (L - z1)] (1/2 Sinh[b z1] - 1/2 Cos[t/2]^2 Sinh[b z1] +
1/2 Sin[t/2]^2 Sinh[b z1]),
1/2 Cos[b (L - z1)] Cos[a b^2 z1] Sin[t] +
1/2 Cos[a b^2 z1] Cosh[b (L - z1)] Sin[t] - (
a A L^2 Sin[b (L - z1)] Sin[a b^2 z1] Sin[t])/(2 b Iyy) + (
a A L^2 Sin[a b^2 z1] Sin[t] Sinh[b (L - z1)])/(2 b Iyy), (
a A L^2 Cos[a b^2 z1] Sin[b (L - z1)] Sin[t])/(2 b Iyy) +
1/2 Cos[b (L - z1)] Sin[a b^2 z1] Sin[t] +
1/2 Cosh[b (L - z1)] Sin[a b^2 z1] Sin[t] - (
a A L^2 Cos[a b^2 z1] Sin[t] Sinh[b (L - z1)])/(
2 b Iyy), -b^2 (1/2 Cos[b z1] - 1/2 Cos[b z1] Cos[t]) Sin[
b (L - z1)] +
b^2 Cosh[b (L - z1)] (-(1/2) Sin[b z1] - 1/2 Cos[t] Sin[b z1]) -
b^2 Cos[b (L - z1)] (1/2 Sin[b z1] - 1/2 Cos[t] Sin[b z1]) +
b^2 (1/2 Cos[b z1] + 1/2 Cos[b z1] Cos[t]) Sinh[
b (L - z1)], -b^2 Cos[
b (L - z1)] (1/2 Cos[b z1] - 1/2 Cos[b z1] Cos[t]) +
b^2 (-(1/2) Cos[b z1] - 1/2 Cos[b z1] Cos[t]) Cosh[b (L - z1)] -
b^2 Sin[b (L - z1)] (-(1/2) Sin[b z1] + 1/2 Cos[t] Sin[b z1]) +
b^2 (-(1/2) Sin[b z1] - 1/2 Cos[t] Sin[b z1]) Sinh[
b (L - z1)], -b^2 (1/2 Cosh[b z1] + 1/2 Cos[t] Cosh[b z1]) Sin[
b (L - z1)] +
b^2 (1/2 Cosh[b z1] - 1/2 Cos[t/2]^2 Cosh[b z1] +
1/2 Cosh[b z1] Sin[t/2]^2) Sinh[b (L - z1)] -
b^2 Cos[b (L - z1)] (-(1/2) Sinh[b z1] - 1/2 Cos[t] Sinh[b z1]) +
b^2 Cosh[
b (L - z1)] (1/2 Sinh[b z1] - 1/2 Cos[t] Sinh[b z1]), -b^2 Cos[
b (L - z1)] (-(1/2) Cosh[b z1] - 1/2 Cos[t] Cosh[b z1]) +
b^2 Cosh[b (L - z1)] (1/2 Cosh[b z1] - 1/2 Cos[t] Cosh[b z1]) -
b^2 Sin[b (L - z1)] (1/2 Sinh[b z1] + 1/2 Cos[t] Sinh[b z1]) +
b^2 Sinh[
b (L - z1)] (1/2 Sinh[b z1] - 1/2 Cos[t/2]^2 Sinh[b z1] +
1/2 Sin[t/2]^2 Sinh[b z1]), -(1/2) b^2 Cos[b (L - z1)] Cos[
a b^2 z1] Sin[t] +
1/2 b^2 Cos[a b^2 z1] Cosh[b (L - z1)] Sin[t] + (
a A b L^2 Sin[b (L - z1)] Sin[a b^2 z1] Sin[t])/(2 Iyy) + (
a A b L^2 Sin[a b^2 z1] Sin[t] Sinh[b (L - z1)])/(
2 Iyy), -((a A b L^2 Cos[a b^2 z1] Sin[b (L - z1)] Sin[t])/(
2 Iyy)) - 1/2 b^2 Cos[b (L - z1)] Sin[a b^2 z1] Sin[t] +
1/2 b^2 Cosh[b (L - z1)] Sin[a b^2 z1] Sin[t] - (
a A b L^2 Cos[a b^2 z1] Sin[t] Sinh[b (L - z1)])/(
2 Iyy), -b^2 (1/2 Cos[b z1] - 1/2 Cos[b z1] Cos[t]) Sin[
b (L - z1)] +
b^2 Cosh[b (L - z1)] (-(1/2) Sin[b z1] - 1/2 Cos[t] Sin[b z1]) -
b^2 Cos[b (L - z1)] (1/2 Sin[b z1] - 1/2 Cos[t] Sin[b z1]) +
b^2 (1/2 Cos[b z1] + 1/2 Cos[b z1] Cos[t]) Sinh[
b (L - z1)], -b^2 Cos[
b (L - z1)] (1/2 Cos[b z1] - 1/2 Cos[b z1] Cos[t]) +
b^2 (-(1/2) Cos[b z1] - 1/2 Cos[b z1] Cos[t]) Cosh[b (L - z1)] -
b^2 Sin[b (L - z1)] (-(1/2) Sin[b z1] + 1/2 Cos[t] Sin[b z1]) +
b^2 (-(1/2) Sin[b z1] - 1/2 Cos[t] Sin[b z1]) Sinh[
b (L - z1)], -b^2 (1/2 Cosh[b z1] + 1/2 Cos[t] Cosh[b z1]) Sin[
b (L - z1)] +
b^2 (1/2 Cosh[b z1] - 1/2 Cos[t/2]^2 Cosh[b z1] +
1/2 Cosh[b z1] Sin[t/2]^2) Sinh[b (L - z1)] -
b^2 Cos[b (L - z1)] (-(1/2) Sinh[b z1] - 1/2 Cos[t] Sinh[b z1]) +
b^2 Cosh[
b (L - z1)] (1/2 Sinh[b z1] - 1/2 Cos[t] Sinh[b z1]), -b^2 Cos[
b (L - z1)] (-(1/2) Cosh[b z1] - 1/2 Cos[t] Cosh[b z1]) +
b^2 Cosh[b (L - z1)] (1/2 Cosh[b z1] - 1/2 Cos[t] Cosh[b z1]) -
b^2 Sin[b (L - z1)] (1/2 Sinh[b z1] + 1/2 Cos[t] Sinh[b z1]) +
b^2 Sinh[
b (L - z1)] (1/2 Sinh[b z1] - 1/2 Cos[t/2]^2 Sinh[b z1] +
1/2 Sin[t/2]^2 Sinh[b z1]), -(1/2) b^2 Cos[b (L - z1)] Cos[
a b^2 z1] Sin[t] +
1/2 b^2 Cos[a b^2 z1] Cosh[b (L - z1)] Sin[t] + (
a A b L^2 Sin[b (L - z1)] Sin[a b^2 z1] Sin[t])/(2 Iyy) + (
a A b L^2 Sin[a b^2 z1] Sin[t] Sinh[b (L - z1)])/(
2 Iyy), -((a A b L^2 Cos[a b^2 z1] Sin[b (L - z1)] Sin[t])/(
2 Iyy)) - 1/2 b^2 Cos[b (L - z1)] Sin[a b^2 z1] Sin[t] +
1/2 b^2 Cosh[b (L - z1)] Sin[a b^2 z1] Sin[t] - (
a A b L^2 Cos[a b^2 z1] Sin[t] Sinh[b (L - z1)])/(2 Iyy);
Dimensions[R]
MatrixForm[R];
R = Drop[R, , 2, 4, 5];
MatrixForm[R]
Dimensions[R]


I have a matrix R with dimension 3*6, I want to delete columns (2, 4, 5). I tried Drop, but it seems like it is not working. The matrix is reducing to dimension 3*5. Drop works for a matrix containing numbers, but not working well if the matrix consists of symbolic variables.



How do I overcome this?



Also, I tried DeleteCases and Delete, but I still did not get what I wanted.



Mathematica is not giving an error messsage, but the answer it is giving is wrong.







share|improve this question














closed as off-topic by m_goldberg, José Antonio Díaz Navas, MarcoB, Yves Klett, rhermans Aug 31 at 8:05


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – m_goldberg, José Antonio Díaz Navas, MarcoB, Yves Klett, rhermans
If this question can be reworded to fit the rules in the help center, please edit the question.












  • Why don't you give simply R = Array[r, 3,6] as a minima example?
    – Henrik Schumacher
    Aug 24 at 18:57






  • 2




    The syntax Drop[R, , 2, 4, 5] tells Mathematica to drop colums 2 to 4 in steps of 5. Since 2+5>4, only column 2 is dropped.
    – Henrik Schumacher
    Aug 24 at 19:03










  • I know drop function is working for a matrix with the number. But for a matrix with symbols, it is not working. That is why I put everything in the question.
    – vijay
    Aug 24 at 19:05










  • No, there is no difference in the behavior for matrices with or without symbols.
    – Henrik Schumacher
    Aug 24 at 19:07










  • sorry my mistake, I did not understand the syntax properly.
    – vijay
    Aug 24 at 19:11














up vote
3
down vote

favorite












 R= (1/2 Cos[b z1] - 1/2 Cos[b z1] Cos[t]) Sin[b (L - z1)] + 
Cosh[b (L - z1)] (-(1/2) Sin[b z1] - 1/2 Cos[t] Sin[b z1]) +
Cos[b (L - z1)] (1/2 Sin[b z1] -
1/2 Cos[t] Sin[b z1]) + (1/2 Cos[b z1] +
1/2 Cos[b z1] Cos[t]) Sinh[b (L - z1)],
Cos[b (L - z1)] (1/2 Cos[b z1] -
1/2 Cos[b z1] Cos[t]) + (-(1/2) Cos[b z1] -
1/2 Cos[b z1] Cos[t]) Cosh[b (L - z1)] +
Sin[b (L - z1)] (-(1/2) Sin[b z1] +
1/2 Cos[t] Sin[b z1]) + (-(1/2) Sin[b z1] -
1/2 Cos[t] Sin[b z1]) Sinh[
b (L - z1)], (1/2 Cosh[b z1] + 1/2 Cos[t] Cosh[b z1]) Sin[
b (L - z1)] + (1/2 Cosh[b z1] - 1/2 Cos[t/2]^2 Cosh[b z1] +
1/2 Cosh[b z1] Sin[t/2]^2) Sinh[b (L - z1)] +
Cos[b (L - z1)] (-(1/2) Sinh[b z1] - 1/2 Cos[t] Sinh[b z1]) +
Cosh[b (L - z1)] (1/2 Sinh[b z1] - 1/2 Cos[t] Sinh[b z1]),
Cos[b (L - z1)] (-(1/2) Cosh[b z1] - 1/2 Cos[t] Cosh[b z1]) +
Cosh[b (L - z1)] (1/2 Cosh[b z1] - 1/2 Cos[t] Cosh[b z1]) +
Sin[b (L - z1)] (1/2 Sinh[b z1] + 1/2 Cos[t] Sinh[b z1]) +
Sinh[b (L - z1)] (1/2 Sinh[b z1] - 1/2 Cos[t/2]^2 Sinh[b z1] +
1/2 Sin[t/2]^2 Sinh[b z1]),
1/2 Cos[b (L - z1)] Cos[a b^2 z1] Sin[t] +
1/2 Cos[a b^2 z1] Cosh[b (L - z1)] Sin[t] - (
a A L^2 Sin[b (L - z1)] Sin[a b^2 z1] Sin[t])/(2 b Iyy) + (
a A L^2 Sin[a b^2 z1] Sin[t] Sinh[b (L - z1)])/(2 b Iyy), (
a A L^2 Cos[a b^2 z1] Sin[b (L - z1)] Sin[t])/(2 b Iyy) +
1/2 Cos[b (L - z1)] Sin[a b^2 z1] Sin[t] +
1/2 Cosh[b (L - z1)] Sin[a b^2 z1] Sin[t] - (
a A L^2 Cos[a b^2 z1] Sin[t] Sinh[b (L - z1)])/(
2 b Iyy), -b^2 (1/2 Cos[b z1] - 1/2 Cos[b z1] Cos[t]) Sin[
b (L - z1)] +
b^2 Cosh[b (L - z1)] (-(1/2) Sin[b z1] - 1/2 Cos[t] Sin[b z1]) -
b^2 Cos[b (L - z1)] (1/2 Sin[b z1] - 1/2 Cos[t] Sin[b z1]) +
b^2 (1/2 Cos[b z1] + 1/2 Cos[b z1] Cos[t]) Sinh[
b (L - z1)], -b^2 Cos[
b (L - z1)] (1/2 Cos[b z1] - 1/2 Cos[b z1] Cos[t]) +
b^2 (-(1/2) Cos[b z1] - 1/2 Cos[b z1] Cos[t]) Cosh[b (L - z1)] -
b^2 Sin[b (L - z1)] (-(1/2) Sin[b z1] + 1/2 Cos[t] Sin[b z1]) +
b^2 (-(1/2) Sin[b z1] - 1/2 Cos[t] Sin[b z1]) Sinh[
b (L - z1)], -b^2 (1/2 Cosh[b z1] + 1/2 Cos[t] Cosh[b z1]) Sin[
b (L - z1)] +
b^2 (1/2 Cosh[b z1] - 1/2 Cos[t/2]^2 Cosh[b z1] +
1/2 Cosh[b z1] Sin[t/2]^2) Sinh[b (L - z1)] -
b^2 Cos[b (L - z1)] (-(1/2) Sinh[b z1] - 1/2 Cos[t] Sinh[b z1]) +
b^2 Cosh[
b (L - z1)] (1/2 Sinh[b z1] - 1/2 Cos[t] Sinh[b z1]), -b^2 Cos[
b (L - z1)] (-(1/2) Cosh[b z1] - 1/2 Cos[t] Cosh[b z1]) +
b^2 Cosh[b (L - z1)] (1/2 Cosh[b z1] - 1/2 Cos[t] Cosh[b z1]) -
b^2 Sin[b (L - z1)] (1/2 Sinh[b z1] + 1/2 Cos[t] Sinh[b z1]) +
b^2 Sinh[
b (L - z1)] (1/2 Sinh[b z1] - 1/2 Cos[t/2]^2 Sinh[b z1] +
1/2 Sin[t/2]^2 Sinh[b z1]), -(1/2) b^2 Cos[b (L - z1)] Cos[
a b^2 z1] Sin[t] +
1/2 b^2 Cos[a b^2 z1] Cosh[b (L - z1)] Sin[t] + (
a A b L^2 Sin[b (L - z1)] Sin[a b^2 z1] Sin[t])/(2 Iyy) + (
a A b L^2 Sin[a b^2 z1] Sin[t] Sinh[b (L - z1)])/(
2 Iyy), -((a A b L^2 Cos[a b^2 z1] Sin[b (L - z1)] Sin[t])/(
2 Iyy)) - 1/2 b^2 Cos[b (L - z1)] Sin[a b^2 z1] Sin[t] +
1/2 b^2 Cosh[b (L - z1)] Sin[a b^2 z1] Sin[t] - (
a A b L^2 Cos[a b^2 z1] Sin[t] Sinh[b (L - z1)])/(
2 Iyy), -b^2 (1/2 Cos[b z1] - 1/2 Cos[b z1] Cos[t]) Sin[
b (L - z1)] +
b^2 Cosh[b (L - z1)] (-(1/2) Sin[b z1] - 1/2 Cos[t] Sin[b z1]) -
b^2 Cos[b (L - z1)] (1/2 Sin[b z1] - 1/2 Cos[t] Sin[b z1]) +
b^2 (1/2 Cos[b z1] + 1/2 Cos[b z1] Cos[t]) Sinh[
b (L - z1)], -b^2 Cos[
b (L - z1)] (1/2 Cos[b z1] - 1/2 Cos[b z1] Cos[t]) +
b^2 (-(1/2) Cos[b z1] - 1/2 Cos[b z1] Cos[t]) Cosh[b (L - z1)] -
b^2 Sin[b (L - z1)] (-(1/2) Sin[b z1] + 1/2 Cos[t] Sin[b z1]) +
b^2 (-(1/2) Sin[b z1] - 1/2 Cos[t] Sin[b z1]) Sinh[
b (L - z1)], -b^2 (1/2 Cosh[b z1] + 1/2 Cos[t] Cosh[b z1]) Sin[
b (L - z1)] +
b^2 (1/2 Cosh[b z1] - 1/2 Cos[t/2]^2 Cosh[b z1] +
1/2 Cosh[b z1] Sin[t/2]^2) Sinh[b (L - z1)] -
b^2 Cos[b (L - z1)] (-(1/2) Sinh[b z1] - 1/2 Cos[t] Sinh[b z1]) +
b^2 Cosh[
b (L - z1)] (1/2 Sinh[b z1] - 1/2 Cos[t] Sinh[b z1]), -b^2 Cos[
b (L - z1)] (-(1/2) Cosh[b z1] - 1/2 Cos[t] Cosh[b z1]) +
b^2 Cosh[b (L - z1)] (1/2 Cosh[b z1] - 1/2 Cos[t] Cosh[b z1]) -
b^2 Sin[b (L - z1)] (1/2 Sinh[b z1] + 1/2 Cos[t] Sinh[b z1]) +
b^2 Sinh[
b (L - z1)] (1/2 Sinh[b z1] - 1/2 Cos[t/2]^2 Sinh[b z1] +
1/2 Sin[t/2]^2 Sinh[b z1]), -(1/2) b^2 Cos[b (L - z1)] Cos[
a b^2 z1] Sin[t] +
1/2 b^2 Cos[a b^2 z1] Cosh[b (L - z1)] Sin[t] + (
a A b L^2 Sin[b (L - z1)] Sin[a b^2 z1] Sin[t])/(2 Iyy) + (
a A b L^2 Sin[a b^2 z1] Sin[t] Sinh[b (L - z1)])/(
2 Iyy), -((a A b L^2 Cos[a b^2 z1] Sin[b (L - z1)] Sin[t])/(
2 Iyy)) - 1/2 b^2 Cos[b (L - z1)] Sin[a b^2 z1] Sin[t] +
1/2 b^2 Cosh[b (L - z1)] Sin[a b^2 z1] Sin[t] - (
a A b L^2 Cos[a b^2 z1] Sin[t] Sinh[b (L - z1)])/(2 Iyy);
Dimensions[R]
MatrixForm[R];
R = Drop[R, , 2, 4, 5];
MatrixForm[R]
Dimensions[R]


I have a matrix R with dimension 3*6, I want to delete columns (2, 4, 5). I tried Drop, but it seems like it is not working. The matrix is reducing to dimension 3*5. Drop works for a matrix containing numbers, but not working well if the matrix consists of symbolic variables.



How do I overcome this?



Also, I tried DeleteCases and Delete, but I still did not get what I wanted.



Mathematica is not giving an error messsage, but the answer it is giving is wrong.







share|improve this question














closed as off-topic by m_goldberg, José Antonio Díaz Navas, MarcoB, Yves Klett, rhermans Aug 31 at 8:05


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – m_goldberg, José Antonio Díaz Navas, MarcoB, Yves Klett, rhermans
If this question can be reworded to fit the rules in the help center, please edit the question.












  • Why don't you give simply R = Array[r, 3,6] as a minima example?
    – Henrik Schumacher
    Aug 24 at 18:57






  • 2




    The syntax Drop[R, , 2, 4, 5] tells Mathematica to drop colums 2 to 4 in steps of 5. Since 2+5>4, only column 2 is dropped.
    – Henrik Schumacher
    Aug 24 at 19:03










  • I know drop function is working for a matrix with the number. But for a matrix with symbols, it is not working. That is why I put everything in the question.
    – vijay
    Aug 24 at 19:05










  • No, there is no difference in the behavior for matrices with or without symbols.
    – Henrik Schumacher
    Aug 24 at 19:07










  • sorry my mistake, I did not understand the syntax properly.
    – vijay
    Aug 24 at 19:11












up vote
3
down vote

favorite









up vote
3
down vote

favorite











 R= (1/2 Cos[b z1] - 1/2 Cos[b z1] Cos[t]) Sin[b (L - z1)] + 
Cosh[b (L - z1)] (-(1/2) Sin[b z1] - 1/2 Cos[t] Sin[b z1]) +
Cos[b (L - z1)] (1/2 Sin[b z1] -
1/2 Cos[t] Sin[b z1]) + (1/2 Cos[b z1] +
1/2 Cos[b z1] Cos[t]) Sinh[b (L - z1)],
Cos[b (L - z1)] (1/2 Cos[b z1] -
1/2 Cos[b z1] Cos[t]) + (-(1/2) Cos[b z1] -
1/2 Cos[b z1] Cos[t]) Cosh[b (L - z1)] +
Sin[b (L - z1)] (-(1/2) Sin[b z1] +
1/2 Cos[t] Sin[b z1]) + (-(1/2) Sin[b z1] -
1/2 Cos[t] Sin[b z1]) Sinh[
b (L - z1)], (1/2 Cosh[b z1] + 1/2 Cos[t] Cosh[b z1]) Sin[
b (L - z1)] + (1/2 Cosh[b z1] - 1/2 Cos[t/2]^2 Cosh[b z1] +
1/2 Cosh[b z1] Sin[t/2]^2) Sinh[b (L - z1)] +
Cos[b (L - z1)] (-(1/2) Sinh[b z1] - 1/2 Cos[t] Sinh[b z1]) +
Cosh[b (L - z1)] (1/2 Sinh[b z1] - 1/2 Cos[t] Sinh[b z1]),
Cos[b (L - z1)] (-(1/2) Cosh[b z1] - 1/2 Cos[t] Cosh[b z1]) +
Cosh[b (L - z1)] (1/2 Cosh[b z1] - 1/2 Cos[t] Cosh[b z1]) +
Sin[b (L - z1)] (1/2 Sinh[b z1] + 1/2 Cos[t] Sinh[b z1]) +
Sinh[b (L - z1)] (1/2 Sinh[b z1] - 1/2 Cos[t/2]^2 Sinh[b z1] +
1/2 Sin[t/2]^2 Sinh[b z1]),
1/2 Cos[b (L - z1)] Cos[a b^2 z1] Sin[t] +
1/2 Cos[a b^2 z1] Cosh[b (L - z1)] Sin[t] - (
a A L^2 Sin[b (L - z1)] Sin[a b^2 z1] Sin[t])/(2 b Iyy) + (
a A L^2 Sin[a b^2 z1] Sin[t] Sinh[b (L - z1)])/(2 b Iyy), (
a A L^2 Cos[a b^2 z1] Sin[b (L - z1)] Sin[t])/(2 b Iyy) +
1/2 Cos[b (L - z1)] Sin[a b^2 z1] Sin[t] +
1/2 Cosh[b (L - z1)] Sin[a b^2 z1] Sin[t] - (
a A L^2 Cos[a b^2 z1] Sin[t] Sinh[b (L - z1)])/(
2 b Iyy), -b^2 (1/2 Cos[b z1] - 1/2 Cos[b z1] Cos[t]) Sin[
b (L - z1)] +
b^2 Cosh[b (L - z1)] (-(1/2) Sin[b z1] - 1/2 Cos[t] Sin[b z1]) -
b^2 Cos[b (L - z1)] (1/2 Sin[b z1] - 1/2 Cos[t] Sin[b z1]) +
b^2 (1/2 Cos[b z1] + 1/2 Cos[b z1] Cos[t]) Sinh[
b (L - z1)], -b^2 Cos[
b (L - z1)] (1/2 Cos[b z1] - 1/2 Cos[b z1] Cos[t]) +
b^2 (-(1/2) Cos[b z1] - 1/2 Cos[b z1] Cos[t]) Cosh[b (L - z1)] -
b^2 Sin[b (L - z1)] (-(1/2) Sin[b z1] + 1/2 Cos[t] Sin[b z1]) +
b^2 (-(1/2) Sin[b z1] - 1/2 Cos[t] Sin[b z1]) Sinh[
b (L - z1)], -b^2 (1/2 Cosh[b z1] + 1/2 Cos[t] Cosh[b z1]) Sin[
b (L - z1)] +
b^2 (1/2 Cosh[b z1] - 1/2 Cos[t/2]^2 Cosh[b z1] +
1/2 Cosh[b z1] Sin[t/2]^2) Sinh[b (L - z1)] -
b^2 Cos[b (L - z1)] (-(1/2) Sinh[b z1] - 1/2 Cos[t] Sinh[b z1]) +
b^2 Cosh[
b (L - z1)] (1/2 Sinh[b z1] - 1/2 Cos[t] Sinh[b z1]), -b^2 Cos[
b (L - z1)] (-(1/2) Cosh[b z1] - 1/2 Cos[t] Cosh[b z1]) +
b^2 Cosh[b (L - z1)] (1/2 Cosh[b z1] - 1/2 Cos[t] Cosh[b z1]) -
b^2 Sin[b (L - z1)] (1/2 Sinh[b z1] + 1/2 Cos[t] Sinh[b z1]) +
b^2 Sinh[
b (L - z1)] (1/2 Sinh[b z1] - 1/2 Cos[t/2]^2 Sinh[b z1] +
1/2 Sin[t/2]^2 Sinh[b z1]), -(1/2) b^2 Cos[b (L - z1)] Cos[
a b^2 z1] Sin[t] +
1/2 b^2 Cos[a b^2 z1] Cosh[b (L - z1)] Sin[t] + (
a A b L^2 Sin[b (L - z1)] Sin[a b^2 z1] Sin[t])/(2 Iyy) + (
a A b L^2 Sin[a b^2 z1] Sin[t] Sinh[b (L - z1)])/(
2 Iyy), -((a A b L^2 Cos[a b^2 z1] Sin[b (L - z1)] Sin[t])/(
2 Iyy)) - 1/2 b^2 Cos[b (L - z1)] Sin[a b^2 z1] Sin[t] +
1/2 b^2 Cosh[b (L - z1)] Sin[a b^2 z1] Sin[t] - (
a A b L^2 Cos[a b^2 z1] Sin[t] Sinh[b (L - z1)])/(
2 Iyy), -b^2 (1/2 Cos[b z1] - 1/2 Cos[b z1] Cos[t]) Sin[
b (L - z1)] +
b^2 Cosh[b (L - z1)] (-(1/2) Sin[b z1] - 1/2 Cos[t] Sin[b z1]) -
b^2 Cos[b (L - z1)] (1/2 Sin[b z1] - 1/2 Cos[t] Sin[b z1]) +
b^2 (1/2 Cos[b z1] + 1/2 Cos[b z1] Cos[t]) Sinh[
b (L - z1)], -b^2 Cos[
b (L - z1)] (1/2 Cos[b z1] - 1/2 Cos[b z1] Cos[t]) +
b^2 (-(1/2) Cos[b z1] - 1/2 Cos[b z1] Cos[t]) Cosh[b (L - z1)] -
b^2 Sin[b (L - z1)] (-(1/2) Sin[b z1] + 1/2 Cos[t] Sin[b z1]) +
b^2 (-(1/2) Sin[b z1] - 1/2 Cos[t] Sin[b z1]) Sinh[
b (L - z1)], -b^2 (1/2 Cosh[b z1] + 1/2 Cos[t] Cosh[b z1]) Sin[
b (L - z1)] +
b^2 (1/2 Cosh[b z1] - 1/2 Cos[t/2]^2 Cosh[b z1] +
1/2 Cosh[b z1] Sin[t/2]^2) Sinh[b (L - z1)] -
b^2 Cos[b (L - z1)] (-(1/2) Sinh[b z1] - 1/2 Cos[t] Sinh[b z1]) +
b^2 Cosh[
b (L - z1)] (1/2 Sinh[b z1] - 1/2 Cos[t] Sinh[b z1]), -b^2 Cos[
b (L - z1)] (-(1/2) Cosh[b z1] - 1/2 Cos[t] Cosh[b z1]) +
b^2 Cosh[b (L - z1)] (1/2 Cosh[b z1] - 1/2 Cos[t] Cosh[b z1]) -
b^2 Sin[b (L - z1)] (1/2 Sinh[b z1] + 1/2 Cos[t] Sinh[b z1]) +
b^2 Sinh[
b (L - z1)] (1/2 Sinh[b z1] - 1/2 Cos[t/2]^2 Sinh[b z1] +
1/2 Sin[t/2]^2 Sinh[b z1]), -(1/2) b^2 Cos[b (L - z1)] Cos[
a b^2 z1] Sin[t] +
1/2 b^2 Cos[a b^2 z1] Cosh[b (L - z1)] Sin[t] + (
a A b L^2 Sin[b (L - z1)] Sin[a b^2 z1] Sin[t])/(2 Iyy) + (
a A b L^2 Sin[a b^2 z1] Sin[t] Sinh[b (L - z1)])/(
2 Iyy), -((a A b L^2 Cos[a b^2 z1] Sin[b (L - z1)] Sin[t])/(
2 Iyy)) - 1/2 b^2 Cos[b (L - z1)] Sin[a b^2 z1] Sin[t] +
1/2 b^2 Cosh[b (L - z1)] Sin[a b^2 z1] Sin[t] - (
a A b L^2 Cos[a b^2 z1] Sin[t] Sinh[b (L - z1)])/(2 Iyy);
Dimensions[R]
MatrixForm[R];
R = Drop[R, , 2, 4, 5];
MatrixForm[R]
Dimensions[R]


I have a matrix R with dimension 3*6, I want to delete columns (2, 4, 5). I tried Drop, but it seems like it is not working. The matrix is reducing to dimension 3*5. Drop works for a matrix containing numbers, but not working well if the matrix consists of symbolic variables.



How do I overcome this?



Also, I tried DeleteCases and Delete, but I still did not get what I wanted.



Mathematica is not giving an error messsage, but the answer it is giving is wrong.







share|improve this question














 R= (1/2 Cos[b z1] - 1/2 Cos[b z1] Cos[t]) Sin[b (L - z1)] + 
Cosh[b (L - z1)] (-(1/2) Sin[b z1] - 1/2 Cos[t] Sin[b z1]) +
Cos[b (L - z1)] (1/2 Sin[b z1] -
1/2 Cos[t] Sin[b z1]) + (1/2 Cos[b z1] +
1/2 Cos[b z1] Cos[t]) Sinh[b (L - z1)],
Cos[b (L - z1)] (1/2 Cos[b z1] -
1/2 Cos[b z1] Cos[t]) + (-(1/2) Cos[b z1] -
1/2 Cos[b z1] Cos[t]) Cosh[b (L - z1)] +
Sin[b (L - z1)] (-(1/2) Sin[b z1] +
1/2 Cos[t] Sin[b z1]) + (-(1/2) Sin[b z1] -
1/2 Cos[t] Sin[b z1]) Sinh[
b (L - z1)], (1/2 Cosh[b z1] + 1/2 Cos[t] Cosh[b z1]) Sin[
b (L - z1)] + (1/2 Cosh[b z1] - 1/2 Cos[t/2]^2 Cosh[b z1] +
1/2 Cosh[b z1] Sin[t/2]^2) Sinh[b (L - z1)] +
Cos[b (L - z1)] (-(1/2) Sinh[b z1] - 1/2 Cos[t] Sinh[b z1]) +
Cosh[b (L - z1)] (1/2 Sinh[b z1] - 1/2 Cos[t] Sinh[b z1]),
Cos[b (L - z1)] (-(1/2) Cosh[b z1] - 1/2 Cos[t] Cosh[b z1]) +
Cosh[b (L - z1)] (1/2 Cosh[b z1] - 1/2 Cos[t] Cosh[b z1]) +
Sin[b (L - z1)] (1/2 Sinh[b z1] + 1/2 Cos[t] Sinh[b z1]) +
Sinh[b (L - z1)] (1/2 Sinh[b z1] - 1/2 Cos[t/2]^2 Sinh[b z1] +
1/2 Sin[t/2]^2 Sinh[b z1]),
1/2 Cos[b (L - z1)] Cos[a b^2 z1] Sin[t] +
1/2 Cos[a b^2 z1] Cosh[b (L - z1)] Sin[t] - (
a A L^2 Sin[b (L - z1)] Sin[a b^2 z1] Sin[t])/(2 b Iyy) + (
a A L^2 Sin[a b^2 z1] Sin[t] Sinh[b (L - z1)])/(2 b Iyy), (
a A L^2 Cos[a b^2 z1] Sin[b (L - z1)] Sin[t])/(2 b Iyy) +
1/2 Cos[b (L - z1)] Sin[a b^2 z1] Sin[t] +
1/2 Cosh[b (L - z1)] Sin[a b^2 z1] Sin[t] - (
a A L^2 Cos[a b^2 z1] Sin[t] Sinh[b (L - z1)])/(
2 b Iyy), -b^2 (1/2 Cos[b z1] - 1/2 Cos[b z1] Cos[t]) Sin[
b (L - z1)] +
b^2 Cosh[b (L - z1)] (-(1/2) Sin[b z1] - 1/2 Cos[t] Sin[b z1]) -
b^2 Cos[b (L - z1)] (1/2 Sin[b z1] - 1/2 Cos[t] Sin[b z1]) +
b^2 (1/2 Cos[b z1] + 1/2 Cos[b z1] Cos[t]) Sinh[
b (L - z1)], -b^2 Cos[
b (L - z1)] (1/2 Cos[b z1] - 1/2 Cos[b z1] Cos[t]) +
b^2 (-(1/2) Cos[b z1] - 1/2 Cos[b z1] Cos[t]) Cosh[b (L - z1)] -
b^2 Sin[b (L - z1)] (-(1/2) Sin[b z1] + 1/2 Cos[t] Sin[b z1]) +
b^2 (-(1/2) Sin[b z1] - 1/2 Cos[t] Sin[b z1]) Sinh[
b (L - z1)], -b^2 (1/2 Cosh[b z1] + 1/2 Cos[t] Cosh[b z1]) Sin[
b (L - z1)] +
b^2 (1/2 Cosh[b z1] - 1/2 Cos[t/2]^2 Cosh[b z1] +
1/2 Cosh[b z1] Sin[t/2]^2) Sinh[b (L - z1)] -
b^2 Cos[b (L - z1)] (-(1/2) Sinh[b z1] - 1/2 Cos[t] Sinh[b z1]) +
b^2 Cosh[
b (L - z1)] (1/2 Sinh[b z1] - 1/2 Cos[t] Sinh[b z1]), -b^2 Cos[
b (L - z1)] (-(1/2) Cosh[b z1] - 1/2 Cos[t] Cosh[b z1]) +
b^2 Cosh[b (L - z1)] (1/2 Cosh[b z1] - 1/2 Cos[t] Cosh[b z1]) -
b^2 Sin[b (L - z1)] (1/2 Sinh[b z1] + 1/2 Cos[t] Sinh[b z1]) +
b^2 Sinh[
b (L - z1)] (1/2 Sinh[b z1] - 1/2 Cos[t/2]^2 Sinh[b z1] +
1/2 Sin[t/2]^2 Sinh[b z1]), -(1/2) b^2 Cos[b (L - z1)] Cos[
a b^2 z1] Sin[t] +
1/2 b^2 Cos[a b^2 z1] Cosh[b (L - z1)] Sin[t] + (
a A b L^2 Sin[b (L - z1)] Sin[a b^2 z1] Sin[t])/(2 Iyy) + (
a A b L^2 Sin[a b^2 z1] Sin[t] Sinh[b (L - z1)])/(
2 Iyy), -((a A b L^2 Cos[a b^2 z1] Sin[b (L - z1)] Sin[t])/(
2 Iyy)) - 1/2 b^2 Cos[b (L - z1)] Sin[a b^2 z1] Sin[t] +
1/2 b^2 Cosh[b (L - z1)] Sin[a b^2 z1] Sin[t] - (
a A b L^2 Cos[a b^2 z1] Sin[t] Sinh[b (L - z1)])/(
2 Iyy), -b^2 (1/2 Cos[b z1] - 1/2 Cos[b z1] Cos[t]) Sin[
b (L - z1)] +
b^2 Cosh[b (L - z1)] (-(1/2) Sin[b z1] - 1/2 Cos[t] Sin[b z1]) -
b^2 Cos[b (L - z1)] (1/2 Sin[b z1] - 1/2 Cos[t] Sin[b z1]) +
b^2 (1/2 Cos[b z1] + 1/2 Cos[b z1] Cos[t]) Sinh[
b (L - z1)], -b^2 Cos[
b (L - z1)] (1/2 Cos[b z1] - 1/2 Cos[b z1] Cos[t]) +
b^2 (-(1/2) Cos[b z1] - 1/2 Cos[b z1] Cos[t]) Cosh[b (L - z1)] -
b^2 Sin[b (L - z1)] (-(1/2) Sin[b z1] + 1/2 Cos[t] Sin[b z1]) +
b^2 (-(1/2) Sin[b z1] - 1/2 Cos[t] Sin[b z1]) Sinh[
b (L - z1)], -b^2 (1/2 Cosh[b z1] + 1/2 Cos[t] Cosh[b z1]) Sin[
b (L - z1)] +
b^2 (1/2 Cosh[b z1] - 1/2 Cos[t/2]^2 Cosh[b z1] +
1/2 Cosh[b z1] Sin[t/2]^2) Sinh[b (L - z1)] -
b^2 Cos[b (L - z1)] (-(1/2) Sinh[b z1] - 1/2 Cos[t] Sinh[b z1]) +
b^2 Cosh[
b (L - z1)] (1/2 Sinh[b z1] - 1/2 Cos[t] Sinh[b z1]), -b^2 Cos[
b (L - z1)] (-(1/2) Cosh[b z1] - 1/2 Cos[t] Cosh[b z1]) +
b^2 Cosh[b (L - z1)] (1/2 Cosh[b z1] - 1/2 Cos[t] Cosh[b z1]) -
b^2 Sin[b (L - z1)] (1/2 Sinh[b z1] + 1/2 Cos[t] Sinh[b z1]) +
b^2 Sinh[
b (L - z1)] (1/2 Sinh[b z1] - 1/2 Cos[t/2]^2 Sinh[b z1] +
1/2 Sin[t/2]^2 Sinh[b z1]), -(1/2) b^2 Cos[b (L - z1)] Cos[
a b^2 z1] Sin[t] +
1/2 b^2 Cos[a b^2 z1] Cosh[b (L - z1)] Sin[t] + (
a A b L^2 Sin[b (L - z1)] Sin[a b^2 z1] Sin[t])/(2 Iyy) + (
a A b L^2 Sin[a b^2 z1] Sin[t] Sinh[b (L - z1)])/(
2 Iyy), -((a A b L^2 Cos[a b^2 z1] Sin[b (L - z1)] Sin[t])/(
2 Iyy)) - 1/2 b^2 Cos[b (L - z1)] Sin[a b^2 z1] Sin[t] +
1/2 b^2 Cosh[b (L - z1)] Sin[a b^2 z1] Sin[t] - (
a A b L^2 Cos[a b^2 z1] Sin[t] Sinh[b (L - z1)])/(2 Iyy);
Dimensions[R]
MatrixForm[R];
R = Drop[R, , 2, 4, 5];
MatrixForm[R]
Dimensions[R]


I have a matrix R with dimension 3*6, I want to delete columns (2, 4, 5). I tried Drop, but it seems like it is not working. The matrix is reducing to dimension 3*5. Drop works for a matrix containing numbers, but not working well if the matrix consists of symbolic variables.



How do I overcome this?



Also, I tried DeleteCases and Delete, but I still did not get what I wanted.



Mathematica is not giving an error messsage, but the answer it is giving is wrong.









share|improve this question













share|improve this question




share|improve this question








edited Aug 25 at 10:01









Alexey Popkov

37.5k4102254




37.5k4102254










asked Aug 24 at 18:55









vijay

1157




1157




closed as off-topic by m_goldberg, José Antonio Díaz Navas, MarcoB, Yves Klett, rhermans Aug 31 at 8:05


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – m_goldberg, José Antonio Díaz Navas, MarcoB, Yves Klett, rhermans
If this question can be reworded to fit the rules in the help center, please edit the question.




closed as off-topic by m_goldberg, José Antonio Díaz Navas, MarcoB, Yves Klett, rhermans Aug 31 at 8:05


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – m_goldberg, José Antonio Díaz Navas, MarcoB, Yves Klett, rhermans
If this question can be reworded to fit the rules in the help center, please edit the question.











  • Why don't you give simply R = Array[r, 3,6] as a minima example?
    – Henrik Schumacher
    Aug 24 at 18:57






  • 2




    The syntax Drop[R, , 2, 4, 5] tells Mathematica to drop colums 2 to 4 in steps of 5. Since 2+5>4, only column 2 is dropped.
    – Henrik Schumacher
    Aug 24 at 19:03










  • I know drop function is working for a matrix with the number. But for a matrix with symbols, it is not working. That is why I put everything in the question.
    – vijay
    Aug 24 at 19:05










  • No, there is no difference in the behavior for matrices with or without symbols.
    – Henrik Schumacher
    Aug 24 at 19:07










  • sorry my mistake, I did not understand the syntax properly.
    – vijay
    Aug 24 at 19:11
















  • Why don't you give simply R = Array[r, 3,6] as a minima example?
    – Henrik Schumacher
    Aug 24 at 18:57






  • 2




    The syntax Drop[R, , 2, 4, 5] tells Mathematica to drop colums 2 to 4 in steps of 5. Since 2+5>4, only column 2 is dropped.
    – Henrik Schumacher
    Aug 24 at 19:03










  • I know drop function is working for a matrix with the number. But for a matrix with symbols, it is not working. That is why I put everything in the question.
    – vijay
    Aug 24 at 19:05










  • No, there is no difference in the behavior for matrices with or without symbols.
    – Henrik Schumacher
    Aug 24 at 19:07










  • sorry my mistake, I did not understand the syntax properly.
    – vijay
    Aug 24 at 19:11















Why don't you give simply R = Array[r, 3,6] as a minima example?
– Henrik Schumacher
Aug 24 at 18:57




Why don't you give simply R = Array[r, 3,6] as a minima example?
– Henrik Schumacher
Aug 24 at 18:57




2




2




The syntax Drop[R, , 2, 4, 5] tells Mathematica to drop colums 2 to 4 in steps of 5. Since 2+5>4, only column 2 is dropped.
– Henrik Schumacher
Aug 24 at 19:03




The syntax Drop[R, , 2, 4, 5] tells Mathematica to drop colums 2 to 4 in steps of 5. Since 2+5>4, only column 2 is dropped.
– Henrik Schumacher
Aug 24 at 19:03












I know drop function is working for a matrix with the number. But for a matrix with symbols, it is not working. That is why I put everything in the question.
– vijay
Aug 24 at 19:05




I know drop function is working for a matrix with the number. But for a matrix with symbols, it is not working. That is why I put everything in the question.
– vijay
Aug 24 at 19:05












No, there is no difference in the behavior for matrices with or without symbols.
– Henrik Schumacher
Aug 24 at 19:07




No, there is no difference in the behavior for matrices with or without symbols.
– Henrik Schumacher
Aug 24 at 19:07












sorry my mistake, I did not understand the syntax properly.
– vijay
Aug 24 at 19:11




sorry my mistake, I did not understand the syntax properly.
– vijay
Aug 24 at 19:11










2 Answers
2






active

oldest

votes

















up vote
8
down vote



accepted










The syntax Drop[R, , 2, 4, 5] tells Mathematica to drop colums 2 to 4 in steps of 5. Since 2+5>4, only column 2 is dropped.



What you want to do can be done, for example, with



R[[All, Complement[Range[Dimensions[R][[2]]], 2, 4, 5]]]


or



R[[All, 1,3,6]]





share|improve this answer



























    up vote
    7
    down vote













    Here are some formulations that allow you to work in terms of the column indexes of the columns you want to delete, rather than their complement.



    Let r be defined by



    r = Array[a, 3, 6]



    a[1, 1], a[1, 2], a[1, 3], a[1, 4], a[1, 5], a[1, 6], 
    a[2, 1], a[2, 2], a[2, 3], a[2, 4], a[2, 5], a[2, 6],
    a[3, 1], a[3, 2], a[3, 3], a[3, 4], a[3, 5], a[3, 6]



    Then evaluating any of follow expressions



    ReplacePart[r, 4 -> Nothing]
    Delete[2, 4, 5] /@ r
    MapAt[Nothing, 2, 4, 5] /@ r


    will give




    a[1, 1], a[1, 3], a[1, 6], 
    a[2, 1], a[2, 3], a[2, 6],
    a[3, 1], a[3, 3], a[3, 6]






    share|improve this answer
















    • 1




      Nice! (+1) As a side remark: It might not be relevant to the OP for their matrix is rather small, but each of this method unpacks arrays.
      – Henrik Schumacher
      Aug 24 at 20:35

















    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    8
    down vote



    accepted










    The syntax Drop[R, , 2, 4, 5] tells Mathematica to drop colums 2 to 4 in steps of 5. Since 2+5>4, only column 2 is dropped.



    What you want to do can be done, for example, with



    R[[All, Complement[Range[Dimensions[R][[2]]], 2, 4, 5]]]


    or



    R[[All, 1,3,6]]





    share|improve this answer
























      up vote
      8
      down vote



      accepted










      The syntax Drop[R, , 2, 4, 5] tells Mathematica to drop colums 2 to 4 in steps of 5. Since 2+5>4, only column 2 is dropped.



      What you want to do can be done, for example, with



      R[[All, Complement[Range[Dimensions[R][[2]]], 2, 4, 5]]]


      or



      R[[All, 1,3,6]]





      share|improve this answer






















        up vote
        8
        down vote



        accepted







        up vote
        8
        down vote



        accepted






        The syntax Drop[R, , 2, 4, 5] tells Mathematica to drop colums 2 to 4 in steps of 5. Since 2+5>4, only column 2 is dropped.



        What you want to do can be done, for example, with



        R[[All, Complement[Range[Dimensions[R][[2]]], 2, 4, 5]]]


        or



        R[[All, 1,3,6]]





        share|improve this answer












        The syntax Drop[R, , 2, 4, 5] tells Mathematica to drop colums 2 to 4 in steps of 5. Since 2+5>4, only column 2 is dropped.



        What you want to do can be done, for example, with



        R[[All, Complement[Range[Dimensions[R][[2]]], 2, 4, 5]]]


        or



        R[[All, 1,3,6]]






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Aug 24 at 19:04









        Henrik Schumacher

        36k249102




        36k249102




















            up vote
            7
            down vote













            Here are some formulations that allow you to work in terms of the column indexes of the columns you want to delete, rather than their complement.



            Let r be defined by



            r = Array[a, 3, 6]



            a[1, 1], a[1, 2], a[1, 3], a[1, 4], a[1, 5], a[1, 6], 
            a[2, 1], a[2, 2], a[2, 3], a[2, 4], a[2, 5], a[2, 6],
            a[3, 1], a[3, 2], a[3, 3], a[3, 4], a[3, 5], a[3, 6]



            Then evaluating any of follow expressions



            ReplacePart[r, 4 -> Nothing]
            Delete[2, 4, 5] /@ r
            MapAt[Nothing, 2, 4, 5] /@ r


            will give




            a[1, 1], a[1, 3], a[1, 6], 
            a[2, 1], a[2, 3], a[2, 6],
            a[3, 1], a[3, 3], a[3, 6]






            share|improve this answer
















            • 1




              Nice! (+1) As a side remark: It might not be relevant to the OP for their matrix is rather small, but each of this method unpacks arrays.
              – Henrik Schumacher
              Aug 24 at 20:35














            up vote
            7
            down vote













            Here are some formulations that allow you to work in terms of the column indexes of the columns you want to delete, rather than their complement.



            Let r be defined by



            r = Array[a, 3, 6]



            a[1, 1], a[1, 2], a[1, 3], a[1, 4], a[1, 5], a[1, 6], 
            a[2, 1], a[2, 2], a[2, 3], a[2, 4], a[2, 5], a[2, 6],
            a[3, 1], a[3, 2], a[3, 3], a[3, 4], a[3, 5], a[3, 6]



            Then evaluating any of follow expressions



            ReplacePart[r, 4 -> Nothing]
            Delete[2, 4, 5] /@ r
            MapAt[Nothing, 2, 4, 5] /@ r


            will give




            a[1, 1], a[1, 3], a[1, 6], 
            a[2, 1], a[2, 3], a[2, 6],
            a[3, 1], a[3, 3], a[3, 6]






            share|improve this answer
















            • 1




              Nice! (+1) As a side remark: It might not be relevant to the OP for their matrix is rather small, but each of this method unpacks arrays.
              – Henrik Schumacher
              Aug 24 at 20:35












            up vote
            7
            down vote










            up vote
            7
            down vote









            Here are some formulations that allow you to work in terms of the column indexes of the columns you want to delete, rather than their complement.



            Let r be defined by



            r = Array[a, 3, 6]



            a[1, 1], a[1, 2], a[1, 3], a[1, 4], a[1, 5], a[1, 6], 
            a[2, 1], a[2, 2], a[2, 3], a[2, 4], a[2, 5], a[2, 6],
            a[3, 1], a[3, 2], a[3, 3], a[3, 4], a[3, 5], a[3, 6]



            Then evaluating any of follow expressions



            ReplacePart[r, 4 -> Nothing]
            Delete[2, 4, 5] /@ r
            MapAt[Nothing, 2, 4, 5] /@ r


            will give




            a[1, 1], a[1, 3], a[1, 6], 
            a[2, 1], a[2, 3], a[2, 6],
            a[3, 1], a[3, 3], a[3, 6]






            share|improve this answer












            Here are some formulations that allow you to work in terms of the column indexes of the columns you want to delete, rather than their complement.



            Let r be defined by



            r = Array[a, 3, 6]



            a[1, 1], a[1, 2], a[1, 3], a[1, 4], a[1, 5], a[1, 6], 
            a[2, 1], a[2, 2], a[2, 3], a[2, 4], a[2, 5], a[2, 6],
            a[3, 1], a[3, 2], a[3, 3], a[3, 4], a[3, 5], a[3, 6]



            Then evaluating any of follow expressions



            ReplacePart[r, 4 -> Nothing]
            Delete[2, 4, 5] /@ r
            MapAt[Nothing, 2, 4, 5] /@ r


            will give




            a[1, 1], a[1, 3], a[1, 6], 
            a[2, 1], a[2, 3], a[2, 6],
            a[3, 1], a[3, 3], a[3, 6]







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Aug 24 at 20:16









            m_goldberg

            81.6k869187




            81.6k869187







            • 1




              Nice! (+1) As a side remark: It might not be relevant to the OP for their matrix is rather small, but each of this method unpacks arrays.
              – Henrik Schumacher
              Aug 24 at 20:35












            • 1




              Nice! (+1) As a side remark: It might not be relevant to the OP for their matrix is rather small, but each of this method unpacks arrays.
              – Henrik Schumacher
              Aug 24 at 20:35







            1




            1




            Nice! (+1) As a side remark: It might not be relevant to the OP for their matrix is rather small, but each of this method unpacks arrays.
            – Henrik Schumacher
            Aug 24 at 20:35




            Nice! (+1) As a side remark: It might not be relevant to the OP for their matrix is rather small, but each of this method unpacks arrays.
            – Henrik Schumacher
            Aug 24 at 20:35


            這個網誌中的熱門文章

            How to combine Bézier curves to a surface?

            Carbon dioxide

            Why am i infinitely getting the same tweet with the Twitter Search API?