Skip to main content

convolution_ex

Function convolution_ex 

Source
pub fn convolution_ex(a: &[Ex], b: &[Ex]) -> Vec<Ex> ⓘ
Expand description

Linear convolution of symbolic coefficient lists: c[k] = Σᵢ a[i]·b[k−i] as Ex (the coefficients of the product of two polynomials given by their Ex coefficients). Empty if either input is empty.

§Examples

use symplex::prelude::*;
use symplex::discrete::convolution_ex;

let ctx = Context::new();
symplex::syms!(ctx; a, b);
// (a + x)(b + x): coefficient lists [a, 1] and [b, 1]
let c = convolution_ex(&[a.clone(), ctx.one()], &[b.clone(), ctx.one()]);
assert_eq!(c.len(), 3);
assert_eq!(c[0], &a * &b);
assert_eq!(c[1], &a + &b);
assert_eq!(c[2], ctx.one());