Skip to main content

line_integral_vector

Function line_integral_vector 

Source
pub fn line_integral_vector(
    field: &Matrix,
    vars: &[&Ex],
    curve: &[Ex],
    t: &Ex,
    a: &Ex,
    b: &Ex,
) -> Ex
Expand description

Vector line integral (work) ∫_C F·dr = ∫ₐᵇ F(r(t)) · r′(t) dt.

field is an n×1 column vector in the variables vars; curve gives r(t) component-wise. The result may contain an unevaluated Integral node if no closed form is found.

§Panics

Panics if field is not n×1 with n == vars.len() == curve.len().

§Examples

use symplex::prelude::*;
use symplex::vector::line_integral_vector;

let ctx = Context::new();
let (x, y, t) = (ctx.symbol("x"), ctx.symbol("y"), ctx.symbol("t"));
// Circulation of F = (−y, x) around the unit circle = 2π
let f = Matrix::col_vector(vec![-&y, x.clone()]);
let circle = [t.cos(), t.sin()];
let w = line_integral_vector(&f, &[&x, &y], &circle, &t, &ctx.int(0), &(ctx.pi() * 2));
assert_eq!(w.simplify(), ctx.pi() * 2);