[][src]Macro arthroprod::term

macro_rules! term {
    ($($num:expr) *) => { ... };
    ([$($xi:expr),+], $($num:expr) *) => { ... };
    ($sym:tt, $($num:expr) +) => { ... };
}

Simpler variadic generation of [Term] values. Terms created this way will have a default value (if one is not provided) and a magnitude of 1. See alpha for more information on how the underlying [Alpha] value is generated. It is also possible to specify a set of [Xi] values to use for the term by providing a list of strings to use as the Xi symbolic values.

Panics

Panics if the specified alpha indices do not correspond to an allowed alpha (see [ALLOWED_ALPHA_FORMS]) or if the [Xi] values can not be converted to Strings.

Examples

use arthroprod::algebra::*;

let t1 = term!(0 2 3);
let t2 = -term!("symbolic", 0 1);
let t3 = term!(["X", "Y"], 2);

let a1 = Alpha::new(Sign::Pos, Form::Trivector(Index::Zero, Index::Two, Index::Three)).unwrap();
let a2 = Alpha::new(Sign::Neg, Form::Bivector(Index::Zero, Index::One)).unwrap();
let a3 = Alpha::new(Sign::Pos, Form::Vector(Index::Two)).unwrap();

assert_eq!(t1, Term::new(None, a1));
assert_eq!(t2, Term::new(Some("symbolic"), a2));
assert_eq!(t3, Term::from_xis_and_alpha(vec!["X", "Y"], a3));