Python Gradient Vector calculation based on formula

Viewed 33

I think I am on the right track but need confirmation of someone wiser than me if my understanding is correct. I want to calculate gradient vector based on formula:

f(x,y) = ix^2 + jy

I would like to know if the following code will do the trick or if there is a better way of doing it:

def grad_vector(i, j, x, y)

    u = 2*i*x
    v = j*y
    return [u, v]
0 Answers
Related