Solved. I think there were two issues here. One was changing the pend function to
function pend(u)
vcat([[0] [1]] * u, -(g/L) .* sin.([[1] [0]] * u))
end
and then the last error associated with that change was because I didn’t put the parameters in Flux.params(p)
, like https://discourse.julialang.org/t/zygote-error-only-reference-types-can-be-differentiated-with-params/38224.
I think the true answer here is why the new array multiplication + vcat worked and the original pend
function did not. @dhairyagandhi96 if you have the reasoning for that, I’ll mark it as the answer