Exemplo n.º 1
0
def apply(given):
    (x, _j), (j, n1) = given.of(All[Indexed >= 1, Tuple[1, Expr]])

    n = n1 - 1
    assert _j == j

    return GreaterEqual(K(x[:n + 1]), K(x[:n]))
Exemplo n.º 2
0
def apply(x):
    n = x.shape[0]
    n -= 1
    assert x.is_positive
    assert n > 0
    return Equal(
        K(x[1:n + 1]) / H(x[1:n + 1]),
        H(x[:n + 1]) / K(x[:n + 1]) - x[0])
Exemplo n.º 3
0
def apply(given):
    (x, _j), (j, n) = given.of(All[Indexed > 0, Tuple[0, Expr]])
    offset = _j - j
    if offset != 0:
        assert not offset._has(j)
        x = x[offset:]

    n = n - 1
    assert n > 0
    return Equal(
        K(x[1:n + 1]) / H(x[1:n + 1]),
        H(x[:n + 1]) / K(x[:n + 1]) - x[0])
Exemplo n.º 4
0
def apply(given):
    (x, _j), (j, n) = given.of(All[Indexed > 0, Tuple[0, Expr]])
    offset = _j - j
    if offset != 0:
        assert not offset._has(j)
        x = x[offset:]
    return Equal(alpha(x[:n]), H(x[:n]) / K(x[:n]))
Exemplo n.º 5
0
def apply(self):
    assert self.is_alpha
    x = self.arg

    assert x.is_positive
    assert x.shape[0].is_finite

    return Equal(self, H(x) / K(x))
Exemplo n.º 6
0
def prove(Eq):
    from axiom import discrete, algebra
    x = Symbol.x(real=True, positive=True, shape=(oo, ))
    n = Symbol.n(integer=True)

    Eq.hypothesis = apply(alpha(x[:n + 1]))

    Eq.n2 = Suffice(n >= 2, Eq.hypothesis, plausible=True)

    Eq << Eq.n2.this.apply(algebra.suffice.to.all)

    _n = Symbol.n(domain=Range(2, oo))

    Eq << discrete.alpha.to.mul.HK.induct.apply(alpha(x[:_n + 1]))

    Eq << algebra.cond.imply.all.apply(Eq[-1], _n)

    Eq.n1 = Suffice(Equal(n, 1), Eq.hypothesis, plausible=True)

    Eq << Eq.n1.this.apply(algebra.suffice.subs)

    Eq << Eq[-1].this.rhs.subs(
        alpha(x[:2]).this.defun(),
        alpha(x[1]).this.defun(),
        H(x[:2]).this.defun(),
        K(x[:2]).this.defun())

    Eq << Eq[-1].this.rhs.rhs.apart(x=x[1])

    Eq.n1 = algebra.suffice.suffice.imply.suffice.ou.apply(Eq.n1, Eq.n2)

    Eq.n0 = Suffice(Equal(n, 0), Eq.hypothesis, plausible=True)

    Eq << Eq.n0.this.apply(algebra.suffice.subs)

    Eq << Eq[-1].this.rhs.subs(
        alpha(x[0]).this.defun(),
        H(x[0]).this.defun(),
        K(x[0]).this.defun())

    Eq << algebra.suffice.suffice.imply.suffice.ou.apply(Eq.n1, Eq.n0)

    Eq << Eq[-1].this.apply(algebra.suffice.to.all, wrt=n)

    Eq << Eq[-1].simplify()
Exemplo n.º 7
0
def apply(x, wrt=None):
    n = x.shape[0]
    assert n.is_finite
    assert n >= 3

    if wrt is None:
        i = x.generate_var(integer=True, var='i')
    else:
        i = wrt

    return Suffice(All[i:1:n](x[i] > 0), Equal(alpha(x), H(x) / K(x)))
Exemplo n.º 8
0
def apply(x):
    n = x.shape[0]
    n -= 1
    assert n >= 2
    return Equal(alpha(x[:n + 1]), alpha(x[:n - 1]) + (-1) ** n * x[n] / (K(x[:n + 1]) * K(x[:n - 1])))
Exemplo n.º 9
0
def apply(x, n):
    return All[x[:n]:CartesianSpace(Range(1, oo), n)](Greater(K(x[:n]), 0))
Exemplo n.º 10
0
def apply(given):
    from axiom.discrete.K.to.add.definition import K
    (x, _j), (j, n) = given.of(All[Indexed > 0, Tuple[1, Expr]])
    assert _j == j
    return Greater(K(x[:n]), 0)
Exemplo n.º 11
0
def apply(x):
    n = x.shape[0]
    assert x.is_positive
    n -= 1
    assert n >= 1
    return Equal(alpha(reverse(x[1:n + 1])), K(x[:n + 1]) / K(x[:n]))
Exemplo n.º 12
0
def apply(x):
    n = x.shape[0]
    n -= 1
    assert n > 0
    return Equal(H(x[:n + 1]) * K(x[:n]) - H(x[:n]) * K(x[:n + 1]), (-1) ** (n + 1))
Exemplo n.º 13
0
def apply(given):
    (x, _j), (j, n) = given.of(All[Indexed > 0, Tuple[1, Expr]])
    assert _j == j
    return Equal(alpha(x[:n]), H(x[:n]) / K(x[:n]))
Exemplo n.º 14
0
def apply(x):
    n = x.shape[0]
    n -= 1
    assert n >= 1
    return Equal(alpha(x[:n + 1]),
                 alpha(x[:n]) + (-1)**(n + 1) / (K(x[:n + 1]) * K(x[:n])))
Exemplo n.º 15
0
def apply(x, i=None):
    if i is None:
        i = x.generate_var(integer=True, var='i')

    n = x.shape[0]
    return Suffice(All[i:1:n](x[i] > 0), Greater(K(x), 0))
Exemplo n.º 16
0
def apply(x):
    assert x.is_positive
    return Greater(K(x), 0)
Exemplo n.º 17
0
def apply(x):
    n = x.shape[0]
    n -= 1

    return Equal(H(x[:n + 1]) * K(x[:n - 1]) - H(x[:n - 1]) * K(x[:n + 1]), (-1) ** n * x[n])