line integral
For a vector field
In components:

# ∫ F(r(t)) · (dr/dt) dt
dr_dt = jax.jacfwd(r)(t_grid) # tangent
integrand = jnp.sum(F(*r(t_grid)) * dr_dt, axis=-1) # F·dr/dtconservative fields
There exists a scalar potential
exact differentials
These are exactly the conditions
curl condition
In Cartesian:
# check conservative: curl from Jacobian
J = jax.jacfwd(F)(*x)
curl = jnp.array([J[2,1]-J[1,2], J[0,2]-J[2,0], J[1,0]-J[0,1]])finding the potential
Integrate component-by-component along a convenient path (e.g. coordinate axes):