Skip to content

Algebraic Factoring #9

@gitnlsn

Description

@gitnlsn
#[test]
fn square_sample_1() {
    use crate::base::symbol::Symbol;

    let a = &Symbol::variable("a").expr();
    let b = &Symbol::variable("b").expr();
    let two = &Symbol::variable(2).expr();

    assert_eq!(
        Factoring::apply(a * a + two * a * b + b * b),
        (a + b).pow(two)
    );
}

#[test]
fn square_sample_2() {
    use crate::base::symbol::Symbol;

    let a = &Symbol::variable("a").expr();
    let b = &Symbol::variable("b").expr();
    let one = &Symbol::variable(1).expr();
    let two = &Symbol::variable(2).expr();

    assert_eq!(
        Factoring::apply(a * a + a * b + a + b),
        (a + one) * (a + b)
    );
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions