How to obtain the gradient of a function wrt a vector?

I'm new to mathematica and I wanted to obtain the gradient of the following function:

where b_k(s) is the cubic B-spline basis function associated with control point k.

I tried this code:

q = Table[Symbol["q" <> ToString@i], {i, 10}];

y [s_, q_] = Sum[BSplineBasis[3, i, s] * q[[i]], {i, 10}]

dy[s_, q_] = D[y[s], s]

dy2[s_, q_] = D[dy[s], s]

ki[s_, q_] = (dy * dy2)/ dy^3

Ebend [s_, q_, kbend_, li_] = kbend * li * Integrate[ki^2, {s, 0, 1}]


• D[vectorexpression, {vector,1}] – Henrik Schumacher Aug 11 '19 at 19:23
• You define functions like ki and dy, but when you call them you don't supply arguments. Because of that, the functions don't evaluate. – Sjoerd Smit Aug 11 '19 at 20:48