line integral

For a vector field along a curve parameterised by , :

In components: . Reversing orientation of flips the sign.

line-intergral.png

# ∫ 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/dt

conservative fields

is conservative if the line integral depends only on endpoints, not the path:

There exists a scalar potential such that , and:

exact differentials

is an exact differential iff the mixed partials match:

These are exactly the conditions .

curl condition

conservative (in a simply-connected domain). Follows from Stokes’ theorem: .

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):