Exemplo n.º 1
0
def apply(n, k, s0=None, B=None):

    if s0 is None:
        x = Symbol.x(shape=(oo, ), dtype=dtype.integer, finite=True)
        s0 = Symbol.s0(definition=UNION[x[:k]:Stirling.conditionset(n, k, x)](
            x[:k].set_comprehension().set))
    if B is None:
        e = Symbol.e(**s0.element_type.dict)
        B = Symbol.B(definition=UNION[e:s0]({e | {n.set}}))
    return Equality(abs(s0), abs(B))
Exemplo n.º 2
0
def apply(n, k, s2=None, B=None):
    if s2 is None:
        x = Symbol.x(shape=(oo, ), dtype=dtype.integer, finite=True)
        s2 = Symbol.s2(
            definition=UNION[x[:k + 1]:Stirling.conditionset(n + 1, k + 1, x)](
                x[:k + 1].set_comprehension().set))
    e = Symbol.e(**s2.element_type.dict)

    if B is None:
        x = s2.definition.variable.base
        s0 = Symbol.s0(definition=UNION[x[:k]:Stirling.conditionset(n, k, x)](
            x[:k].set_comprehension().set))

        B = Symbol.B(definition=UNION[e:s0]({e | {n.set}}))

    return Equality(conditionset(e, Contains({n}, e), s2), B)