Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
implement generator for beta not pos. integer
Browse files Browse the repository at this point in the history
  • Loading branch information
behackl committed Jan 27, 2016
1 parent 2b95429 commit 63f18f2
Showing 1 changed file with 42 additions and 1 deletion.
43 changes: 42 additions & 1 deletion src/sage/rings/asymptotic/asymptotic_expansion_generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,48 @@ def SingularityAnalysis(var, zeta=1, alpha=0, beta=0, delta=0,
raise NotImplementedError

elif beta != 0:
raise NotImplementedError
if skip_constant_factor:
raise NotImplementedError('Cannot skip constant factor '
'when logarithmic terms occur')
from growth_group import ExponentialGrowthGroup, \
MonomialGrowthGroup
from sage.categories.cartesian_product import cartesian_product

if zeta == 1:
group = cartesian_product(
[MonomialGrowthGroup(alpha.parent(), var),
MonomialGrowthGroup(beta.parent(), 'log({})'.format(var))])
else:
group = cartesian_product(
[ExponentialGrowthGroup((1/zeta).parent(), var),
MonomialGrowthGroup(alpha.parent(), var),
MonomialGrowthGroup(beta.parent(), 'log({})'.format(var))])

A = AsymptoticRing(growth_group=group, coefficient_ring=SR)
n = A.gen()

if zeta == 1:
exponential_factor = 1
else:
exponential_factor = n.rpow(1/zeta)

if beta in ZZ and beta > 0:
# product of iterators needed
from itertools import product, islice
L = _sa_coefficients_lambda_(precision, beta=beta)
summands = iter()
else:
from itertools import count, islice
from sage.functions.other import binomial
from sage.calculus.calculus import limit
s = SR('s')
summands = iter(binomial(beta, k) *
limit((1/gamma(s)).diff(s, k), s=alpha) *
n.log() ** (-k) for k in count())

return exponential_factor * n**(alpha - 1) * n.log()**beta * \
(sum(islice(summands, precision)) +
(n.log()**(-precision)).O())

elif alpha != 0:

Expand Down

0 comments on commit 63f18f2

Please sign in to comment.