0
$\begingroup$

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

Equation

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}]

Grad[Ebend[s, q, kbend, li], q]

but the output is just a list of zeros.

I tried different ways without defining q but it just rewrites the equation instead of calculating the gradient.

Thank you in advance for your help.

$\endgroup$
  • 1
    $\begingroup$ D[vectorexpression, {vector,1}] $\endgroup$ – Henrik Schumacher Aug 11 at 19:23
  • 1
    $\begingroup$ 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. $\endgroup$ – Sjoerd Smit Aug 11 at 20:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.