AutoDiff of function inverse?

I am using a time-dependent invertible map to define a moving geometry: ξ=f(x,t) where ξ,x have the same dimension. For example, this might be a time-varying shift and rotation ξ=R(θ(t))*(x-x₀(t)), or it might be something a little more strange, like a traveling wave deformation.

The velocity of the geometry is then ẋ=ḟ⁻¹(ξ,t)=ḟ⁻¹(f(x,t),t). Is it possible automatically compute this function for a given invertible f? I could ask the user to specify f⁻¹ and then use autodiff, but I feel like the whole thing should be easy enough to do using some form of reverse-diff… But I’m not sure.

Just as comment, there was a similar question in the past

If you have the Jacobian of f, then you can just invert this matrix to get the Jacobian of the inverse function (if it exists locally).

(This was in the second problem set of our matrix calculus course.)

2 Likes

Treating ξ and t as independent variables and x as a dependent variable and using the implicit function theorem, you get:

f(x,t) - ξ = 0
∂f/∂t + ∂f/∂x * dx/dt = 0
dx/dt = -∂f/∂x \ ∂f/∂t
1 Like

If you want to automate this using AD and make it all Zygote compatible, check my fresh differentiable implicit function implementation here https://github.com/JuliaNonconvex/NonconvexUtils.jl#hack-5-implicitfunction. (but that might be overkill for your case)

3 Likes

I was sooooo close. But I’m glad I asked since now I’m aware of your nice package for implicit functions.

1 Like