Skip to content

Instantly share code, notes, and snippets.

@Observatorio-de-Matematica
Created January 18, 2024 00:54
Show Gist options
  • Save Observatorio-de-Matematica/5420f7818d2c2550bbb610c406a3a43d to your computer and use it in GitHub Desktop.
Save Observatorio-de-Matematica/5420f7818d2c2550bbb610c406a3a43d to your computer and use it in GitHub Desktop.
/* --------------------------------------------------
Compute the line integral of fn along the path path
for parameter values from p0 to p1.
fn is an expression,
path a list of two or three equations, one for each
coordinate. The left hand sides of the equations
are the names of the coordinates, the right
hand sides are expressions in param
---------------------------------------------------*/
lineIntegral(fn, path, param, p0, p1) :=
block ( [substitutedFn, x, xx],
substitutedFn: sublis(path, fn),
x : ev (substitutedFn, diff),
xx: subst(1, Diff(param), x),
Integrate(xx, param, p0, p1)
)$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment