You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have two examples in real use cases that can trigger perturbation confusion error in ForwardDiff.jl.
The first example (Lagrangian):
using ForwardDiff
m,g =1, 9.8
t =1
q = [1,2]
q̇ = [3,4]
L(t,q,q̇) = m/2*dot(q̇,q̇) - m*g*q[2]
∂L∂q̇(L, t, q, q̇) = ForwardDiff.gradient(a->L(t,q,a), q̇)
Dqq̇(L, t, q, q̇) = ForwardDiff.jacobian(a->∂L∂q̇(L,t,a,q̇), q)
Dqq̇(L, t, q, q̇) # ERROR: potential perturbation confusion...
The second one (Hamiltonian):
using ForwardDiff
m,g =1, 9.8
t =1
p = [5,6]
q = [1,2]
functionLegendre_transformation(F, w)
wv = a->ForwardDiff.gradient(F, a)
z =zeros(w)
M = ForwardDiff.jacobian(wv, z)
b =wv(z)
v =Symmetric(M)\(w-b)
w'v -F(v)
endfunctionLagrangian2Hamiltonian(Lagrangian, t, q, p)
L = q̇ ->Lagrangian(t, q, q̇)
Legendre_transformation(L, p)
endLagrangian2Hamiltonian(L, t, q, p) # This is OK
ForwardDiff.gradient(a->Lagrangian2Hamiltonian(L, t, a, p), q)
# ERROR: potential perturbation confusion...
Activity
simonbyrne commentedon Sep 22, 2017
I've just tried these on #247 branch (I had to get rid of the
Symmetricnote since there is no generic Bunch-Kaufman method). I getCan you verify that those are correct?
YingboMa commentedon Sep 24, 2017
@simonbyrne Yes, those are correct.
add tests for JuliaDiff#238