Question: Gradient of f calculated at a point

I want to define a multivariate function f(x1,x2) and its gradient f1(x1,x2) in order to calculate

f(X)=f(X[0])+grad(f(X[0])*(X-X[0])

I try in this way:

with(LinearAlgebra);
f := x -> x[1]^2 + x[2]^2
f1 := x -> <diff(f(x), x[1]), diff(f(x), x[2])>
A := <2,3>
f(A)
     13
f1(A)
     Error, (in f1) invalid input: diff received 2, which is not valid for its 2nd argument
 

What is wrong and how could I define f1(x) in order to write f1(A) for the gradient of f calculated  at A?
Thanks

Please Wait...