Everything else
The binomial coefficient C(n, k).
For integer k and integer n (Python int or integer literals)
this is the exact integer n·(n−1)···(n−k+1)/k! — 0 for k < 0,
and the generalised value for negative n (binomial(-1, k) = (−1)^k). Otherwise it is the symbolic
gamma(n + 1) / (gamma(k + 1) * gamma(n - k + 1)).
alkahest.default_pool() — the process-wide pool that pool-free calls use.
alkahest.sin(2), alkahest.Matrix([[1, 2], [3, 4]]) and the module
constants alkahest.pi / E / I / oo have no Expr argument
to take a pool from. They use the pool of the innermost
alkahest.context(pool=...) block if one is open, and this pool
otherwise. It is created on first use and lives for the whole process.
A closed expression from this pool — one with no free symbols, such as
alkahest.pi / 2 or alkahest.sqrt(2) — is a value rather than a
variable, so the arithmetic operators, the function constructors,
subs and Matrix copy it into the pool of the other operand:
x + alkahest.pi works for x from any pool. Expressions with free
symbols are never moved between pools (E-POOL-001).
Distribute products and positive integer powers over sums.
expand((x + 1)**3) is x**3 + 3*x**2 + 3*x + 1 and
expand((x + 1)**2 / x) is x + 2 + 1/x: each term is split into its
numerator factors and its negative-power (denominator) factors, the
numerators over a common denominator are multiplied out and like terms
collected (the polynomial arithmetic behind cancel()), and each
resulting monomial is multiplied by the denominator. Denominators are not
expanded, and neither are the arguments of functions (sin((x+1)**2)
is returned as is) — sub-expressions that are not polynomial are opaque
generators, as in cancel().
Returns an Expr equal to expr. Unlike
simplify_expanded(), which applies the distributive rewrite inside
the general simplifier and stops at a product-size cap, this always
multiplies out completely. Accepts a DerivedResult or a Python
number.
Factor expr over the integers, returning an Expr product.
expr is put over a common denominator (as cancel() does) and the
numerator and denominator are each factored over ℤ — multivariate FLINT,
so x**2 - y**2 gives (x - y)*(x + y). The result is
c · Π pᵢ^eᵢ · Π qⱼ^(−fⱼ) with a rational content c and irreducible
primitive factors.
Sub-expressions that are not polynomial in vars (sin(x), a symbol
not in vars, x**n) are treated as opaque generators, exactly as in
cancel(); vars defaults to the free symbols of expr. Float
coefficients are refused (ConversionError) rather than factored as if
they were exact. Accepts a DerivedResult or a Python number.
>>> p = ExprPool(); x, y = p.symbol("x"), p.symbol("y")
>>> factor(x**2 - 1) # (x - 1)*(x + 1)
>>> factor((x**2 - 1) / (2*x + 2)) # (x - 1)/2n! — an exact integer for a Python int or integer literal
n >= 0, otherwise gamma(n + 1).
A negative integer has no factorial (Γ has a pole there) and raises
DomainError (E-DOMAIN-001) rather than returning a value.
alkahest.solve_proof_status() -> str
How sure the most recent solve() on this thread is that its
answer is complete: "proved" or "probabilistic".
Every tuple solve returns has been substituted back into your equations,
so the tuples are solutions whichever this says. "probabilistic" means the
list came from a Gröbner basis with that
proof_status: in principle a solution could be missing,
with the chance described there. "proved" means no such basis was used,
or that the basis was proved. An inconsistent system's [] is "proved":
the {1} basis behind it has its own proof, by a homogenised run of the
engine (Buchberger if that is inconclusive), which an active Budget can
stop with BudgetExceededError.
Reset by each solve call, like solve_side_conditions().
The n-th derivative zeta^(n)(s) of the Riemann zeta function, the
node zeta_deriv(n, s) (mpmath's zeta(s, 1, n)).
zeta_deriv(0, s) is zeta(s) and zeta_deriv(1, s) is
zeta_prime(s) (with their exact values). diff produces it for the
second and higher derivatives of zeta, and
d/ds zeta_deriv(n, s) = zeta_deriv(n + 1, s). Evaluates in f64,
balls and at complex s through Arb's zeta jet for a literal order
0 <= n <= 200.
Raises SpecialFunctionError: E-SPECFN-* for a literal order that is
not a non-negative integer, E-SPECFN-006 at the pole s = 1.
>>> import alkahest as ak
>>> p = ak.ExprPool(); s = p.symbol("s")
>>> ak.diff(ak.diff(ak.zeta(s), s).value, s).value # zeta_deriv(2, s)No docstring.
No docstring.
No docstring.
No docstring.