ForwardDiff for functions of several (vector) variables?

Is it possible to use ForwardDiff for functions of several variables? In particular, consider a scalar function L(x,u) of two vector variables x and u. I want to compute the gradient of L() with respect to x.

From the documentation it appears that currently ForwardDiff can only compute derivatives and gradients for functions of a single (vector) variable. Any way?

Pass x -> L(x, u) to ForwardDiff.

3 Likes

Many thanks. Besides having my question answered, I think that I am now significantly closer to understanding anonymous functions in Julia.