I want to reflect a given matrix about the y_axis, say:
A = [[1,2], [3,4]]
I used the numpy function, np.fliplr(A) but the test said I was wrong. I then used the numpy function, np.flip(A,1) and still wrong. Please, can anyone help me with reflecting A about the y_axis? Thanks
NB: The matrix above is not the one in the test.
I assume you either want to swap rows or columns. If that is the case I think it may be easier to do it manually like A[[0,1]] = A[[1,0]] for swapping rows, or A[:,[0,1]]= A[:,[1,0]] to swap columns.
The wording of the problem confused me a bit at first, but I think theyâre looking for a 2x2 matrix A_reflection_yaxis that, when multiplied with a vector [x, y], will result in a vector that is a reflection of [x, y] over the y-axis, i.e. A_reflection_yaxis multiplied by [x, y] = [-x, y]. Hope this helps.
I used np.array([[-1,0],[0,1]]) and used the function np.linalg.eig and getting the error 'There was a problem compiling the code from your notebook. Details:
unsupported operand type(s) for *: âNoneTypeâ and âintâ
yes, I think what you used is similar to what I used. I reasoned that the matrix in question are the basis vectors arranged as columns.
Still no reply from the instructors?, its been 10 days
Itâs resolved @Abdullah_Q
I did it but it still not working for me
as original matrix = [[2, 3], [2, 1]]
and yaxis_reflected_matrix = [[-2, 3], [-2, 1]]
and it gives me complex numbers in eigenvectors and eigenvalues (âErrorâ)
IIRC, the original matrix that you are referring to has nothing to do with the exercise you are asking about. I believe they are asking for a 2x2 matrix that transforms a 1x2 vector into its reflection across the y-axis. In other words, can you find a 2x2 matrix A, such that for any 1x2 vector x, the product Ax will equal the reflection of x across the y-axis.
The reflection of any point (x,y) across the y-axis is (-x,y), so we are looking for the matrix A such that A Ă [x y]^T = [-x y]^T.
Oh, thank you. I found it but I didnât expect that he want that answer from me as I get matrix multiplication of A = \begin{bmatrix} 2 && 3 \\ 2 && 1 \end{bmatrix} with y = \begin{bmatrix} -1 && 0 \\ 0 && 1\end{bmatrix} and the result = \begin{bmatrix} -2 && 3 \\ -2 && 1 \end{bmatrix}
I made the same error. Thank you for your persistence in asking the question.
I am getting the same issue (error with complex numbers). I used the same approach when defining the reflection around the Y axis. [[-2,3], [-2,1]]. Unclear how to get around this issue.
@Vince_Kegel How Are You I hope you a good health
First He didnât ask you to make operation multiplication
of Matrix He just wanted the values of the Reflection of Y-Axis
This Image Illustrates what values you enter in your matrix
ask me if you misunderstand this
ATEF
You are correct. Thank you. I need to read the instructions carefully.
Thanks @Atef_Yasser. Your clarification was really helpful. I do think that the wording in the exercise is very confusing and it took me a while to figure out what matrix was being asked just by reading the instructions.
Yes the wording is quite confusing. Thank you
Thank you!
ÂĄMuchas gracias!
![]()
Thanks @Atef_Yasser for solving my confusion here.
I think thatâs the variable name causing the confusion here, if the assignment can rename âA_reflection_yaxisâ to âyaxis_reflection_matrixâ it will be much clearer.
I have spend quite long to figure it out what it is actually asked to do . We do not have to reflect the matrix A about y-axis and we also not asked to find the reflection of the transformation matrix , simply we need to find the reflection of basis vector (1,0) and (0,1) in which y coordinate will remain the same only x coordinate will change its sign ,I hope this will make sense to everyone .
Yea, they def need to change the wording, because it leads you to believe that they want you to transform A into Aâ, where Aâ is the reflection of A. Where A was the same matrix in the first question.
