Esempio n. 1
0
def grothendieck_S(num_variables, mu, nu=(), degree_bound=None):  # noqa
    if type(mu) == Permutation:
        assert nu == ()
        return mu.signed_involution_stable_grothendieck(
            num_variables, degree_bound)
    else:
        return SymmetricPolynomial.stable_grothendieck_s(
            num_variables, mu, nu, degree_bound)
def test_symmetric_functions():
    nn = 6
    for mu in Partition.all(nn):
        for nu in Partition.all(nn, strict=True):
            for n in range(nn):
                print(n, mu, nu)
                print()

                f = SymmetricPolynomial.schur(n, mu, nu)
                g = SymmetricPolynomial.stable_grothendieck(n, mu, nu)
                h = SymmetricPolynomial.dual_stable_grothendieck(n, mu, nu)

                fs = SymmetricPolynomial._slow_schur(n, mu, nu)
                gs = SymmetricPolynomial._slow_stable_grothendieck(n, mu, nu)
                hs = SymmetricPolynomial._slow_dual_stable_grothendieck(
                    n, mu, nu)

                if f != fs:
                    print(f)
                    print(fs)
                    print()
                if g != gs:
                    print(g)
                    print(gs)
                    print()
                if h != hs:
                    print(h)
                    print(hs)
                    print()
                    print()

                assert f == fs
                assert g == gs
                assert h == hs

                hh = SymmetricPolynomial.schur_s(n, mu, nu)
                kk = SymmetricPolynomial.stable_grothendieck_s(n, mu, nu)

                if mu == nu:
                    assert f == 1
                    assert g == 1
                    assert h == 1
                    assert fs == 1
                    assert gs == 1
                    assert hs == 1
                    assert hh == 1
                    assert kk == 1

                if not Partition.contains(mu, nu):
                    assert f == 0
                    assert g == 0
                    assert h == 0
                    assert fs == 0
                    assert gs == 0
                    assert hs == 0
                    assert hh == 0
                    assert kk == 0

                print(f)
                print(g)
                print()
                print(hh)
                print(kk)
                print()
                assert g.lowest_degree_terms() == f
                assert kk.lowest_degree_terms() == hh