def _test_shifted_p(n_max, v_max):
    for n in range(n_max + 1):
        for v in range(1, v_max + 1):
            for lam1 in Partition.all(n, strict=True):
                for lam2 in Partition.all(n, strict=True):
                    print()
                    print()
                    print('* v =', v, ', n =', n, ', mu =', lam1, ', nu =',
                          lam2)
                    print()

                    print('Computing LHS . . .')
                    print()

                    s = Polynomial()
                    for mu in Partition.all(n + max(sum(lam1), sum(lam2)),
                                            strict=True):
                        a = SymmetricPolynomial.stable_grothendieck_p_doublebar(
                            v, mu, lam1).truncate(n).polynomial('x')
                        b = SymmetricPolynomial.dual_stable_grothendieck_q(
                            v, mu, lam2).truncate(n).polynomial('y')
                        s += (a * b).truncate(n)
                        print('  ', mu, ':', s, '|', a, '|', b)
                        print()
                    print('LHS =', s)
                    print()
                    print()

                    print('Computing RHS . . .')
                    print()

                    f = kernel(n, v)
                    print('  ', '   :', f)
                    print()

                    t = Polynomial()
                    for kappa in Partition.subpartitions(lam2, strict=True):
                        a = SymmetricPolynomial.stable_grothendieck_p_doublebar(
                            v, lam2, kappa).truncate(n)
                        b = SymmetricPolynomial.dual_stable_grothendieck_q(
                            v, lam1, kappa).truncate(n)
                        t += (f * a.polynomial('x') *
                              b.polynomial('y')).truncate(n)
                        print('  ', kappa, ':', t)
                        print()

                    print('RHS =', t)
                    print()
                    print()
                    print('diff =', s - t)
                    print()
                    assert s == t
Exemplo n.º 2
0
def test_simple():
    f = SymmetricPolynomial._slow_transposed_dual_stable_grothendieck_q(4, (4,))
    g = SymmetricPolynomial.dual_stable_grothendieck_q(4, (4,))
    assert f.omega_schur_expansion(f) == g.schur_expansion(g)

    f = SymmetricPolynomial._slow_transposed_dual_stable_grothendieck_p(4, (4,))
    g = SymmetricPolynomial.dual_stable_grothendieck_p(4, (4,))
    assert f.omega_schur_expansion(f) == g.schur_expansion(g)
Exemplo n.º 3
0
def test_q(n=4):
    lam = tuple([n - i for i in range(n)])
    for mu in Partition.subpartitions(lam, strict=True):
        for nu in Partition.subpartitions(mu, strict=True):
            f = SymmetricPolynomial._slow_transposed_dual_stable_grothendieck_q(n, mu, nu)
            g = SymmetricPolynomial.dual_stable_grothendieck_q(n, mu, nu)
            ef, eg = f.omega_schur_expansion(f), g.schur_expansion(g)
            print('n =', n, 'mu =', mu)
            print(ef)
            print(eg)
            print()
            assert ef == eg
def test_decompose():
    schur = SymmetricPolynomial.schur
    schur_P = SymmetricPolynomial.schur_p  # noqa
    dual_grothendieck = SymmetricPolynomial.dual_stable_grothendieck
    grothendieck = SymmetricPolynomial.stable_grothendieck
    GP = SymmetricPolynomial.stable_grothendieck_p  # noqa
    GQ = SymmetricPolynomial.stable_grothendieck_q  # noqa

    n = 6
    mu = (3, 2, 1)
    nu = (4, 2, 1)

    f = schur(n, mu) * schur(n, mu)
    exp = SymmetricPolynomial.schur_expansion(f)
    assert f == sum([schur(n, a) * coeff for a, coeff in exp.items()])

    f = schur_P(n, nu)
    exp = SymmetricPolynomial.schur_expansion(f)
    assert f == sum([schur(n, a) * coeff for a, coeff in exp.items()])

    f = GP(n, nu)
    exp = SymmetricPolynomial.grothendieck_expansion(f)
    assert f == sum([grothendieck(n, a) * coeff for a, coeff in exp.items()])

    f = GQ(n, nu)
    exp = SymmetricPolynomial.grothendieck_expansion(f)
    assert f == sum([grothendieck(n, a) * coeff for a, coeff in exp.items()])

    f = SymmetricPolynomial.dual_stable_grothendieck_p(n, nu)
    exp = SymmetricPolynomial.dual_grothendieck_expansion(f)
    assert f == sum(
        [dual_grothendieck(n, a) * coeff for a, coeff in exp.items()])

    f = SymmetricPolynomial.dual_stable_grothendieck_q(n, nu)
    exp = SymmetricPolynomial.dual_grothendieck_expansion(f)
    assert f == sum(
        [dual_grothendieck(n, a) * coeff for a, coeff in exp.items()])
def test_strict_symmetric_functions():
    nn = 5
    for mu in Partition.all(nn, strict=True):
        for nu in Partition.all(nn, strict=True):
            for n in range(nn):
                print(n, mu, nu)
                print()

                # Schur-P and GP

                f = SymmetricPolynomial.schur_p(n, mu, nu)
                g = SymmetricPolynomial.stable_grothendieck_p(n, mu, nu)
                h = SymmetricPolynomial.dual_stable_grothendieck_p(n, mu, nu)

                fs = SymmetricPolynomial._slow_schur_p(n, mu, nu)
                gs = SymmetricPolynomial._slow_stable_grothendieck_p(n, mu, nu)
                hs = SymmetricPolynomial._slow_dual_stable_grothendieck_p(
                    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()
                    print()

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

                if mu == nu:
                    assert f == 1
                    assert g == 1
                    assert h == 1
                    assert fs == 1
                    assert gs == 1
                    assert hs == 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

                # Schur-Q and GQ

                f = SymmetricPolynomial.schur_q(n, mu, nu)
                g = SymmetricPolynomial.stable_grothendieck_q(n, mu, nu)
                h = SymmetricPolynomial.dual_stable_grothendieck_q(n, mu, nu)

                fs = SymmetricPolynomial._slow_schur_q(n, mu, nu)
                gs = SymmetricPolynomial._slow_stable_grothendieck_q(n, mu, nu)
                hs = SymmetricPolynomial._slow_dual_stable_grothendieck_q(
                    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()
                    print()

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

                if mu == nu:
                    assert f == 1
                    assert g == 1
                    assert h == 1
                    assert fs == 1
                    assert gs == 1
                    assert hs == 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
Exemplo n.º 6
0
def dual_grothendieck_Q(num_variables, mu, nu=()):  # noqa
    return SymmetricPolynomial.dual_stable_grothendieck_q(
        num_variables, mu, nu)