Getting gradient of taylorinteg

Learned this recently from @ChrisRackauckas :

using TaylorIntegration, ForwardDiff

function deriv_x!(dx, x, params, t)
	dx = x
end

function f(x_start)
	t, x = taylorinteg(deriv_x!, x_start, convert(eltype(x_start), 0.0), convert(eltype(x_start), 10.),
		15, 1.0e-15, maxsteps=10_000)
	return x[end,:]
end

∇f(x) = ForwardDiff.jacobian(f, x)
print(∇f([1, 2, 3]))
4 Likes