My understanding is to essentially:
- Create the identity matrix
- apply the transformation function to it
- Then take this matrix and multiply it by a vector of interest to scale/shear/etc that vector appropriately
(Let me know if I’m allowed to post this, I assume the only restriction is not posting actual code).
I’ve followed the process above, though I’m seemingly doing something wrong since I’m not passing the tests for this T_hshear
function
It’s fine to describe your code in words, although I’m not clear on what the identity matrix has to do with this.
Please show us the output when you run the test cell. It’s fine to show output, just not the source code, please.
1 Like
@YodaKenobi
you can share screenshot of your failed test results too, or in case share any error you got.
Regards
DP
1 Like
Here are the errors
Regarding “identity matrix”, what I meant was when stacking the 2 basis vectors [0,1] and [1,0] it looks the same as the 2x2 identity matrix:
hi @YodaKenobi
Based on the below image
where it mentions the t shear transformation matrix of first np.array([1, m], [0, 1]) and then compute the transformation using transformation matrix and the vector
if you have used this as per stated, then go back check exercise 1, where v =(x, y), then
T(v) = T((x, y))=(ax, ay)
Then here transformation matrix is np.array of ( [[a,0],[0.a]]) and then the transformation is transformation matrix and the vector
Regards
DP
1 Like
Hi @Deepti_Prasad , thanks for the response.
I think I see where I’m confused: I thought the 2 vectors e1
and e2
should be mapped to [x + m*y, y]
. So given the basis vectors (columns) (1,0)
and (0,1)
in
[1 , 0]
[0, 1 ]
shouldn’t that be (1+m*0, 0)
(column 1) and (0+m*1, 1)
(column 2)? which simplifies to (1, 0)
and (m, 1)
respectively?
Edited: Stupid mistake on my part. When writing it in code, the first array would refer to the first dimension (X), the second array to the Y dimension, and so on. That’s an easy mistake to make with accidentally mixing up writing X,Y vertically vs horizontally in code
hi @YodaKenobi
yes, I think you also got confused with the hint mentioning to check the e1 e2, but didn’t specifically pointed how e1 vector and e2 vector is represented but now you understood.
that’s right
Also as you know the transformation matrix is numpy array matrix multiplication is row wise hence the choice [1,m][0,1]
Regards
DP
1 Like
If anyonoe else finds this, just be careful to note that how you might write the vectors on paper visually may not be the same when you are writing it in code. That was 100% my issue. Thanks @Deepti_Prasad