https://d2l.ai/chapter_appendix-mathematics-for-deep-learning/multivariable-calculus.html

In code section 18.4.6 should the` indexing = 'xy'`

x, y = np.meshgrid(np.linspace(-2, 2, 101),

np.linspace(-2, 2, 101), indexing=‘ij’)

z = x*np.exp(- x2 - y2)

as xy represents cartesian coordinates? Although in the above example it should not matter as x and y for the meshgrid are same.

Hi @sushmit86, great question! I believe it should be an “ij” here. According the NumPy document:

In the 2-D case with inputs of length M and N, the outputs are of shape (N, M) for ‘xy’ indexing and (M, N) for ‘ij’ indexing.

Let me know if it makes sense to you.

Thanks for the explanation.