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

Commit

Permalink
Trac #20040: exchange order of parameters var and zeta in _singularit…
Browse files Browse the repository at this point in the history
…y_analysis_
  • Loading branch information
cheuberg committed Feb 14, 2016
1 parent 902c182 commit 866a9e3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
6 changes: 3 additions & 3 deletions src/sage/rings/asymptotic/growth_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -2882,9 +2882,9 @@ def _singularity_analysis_(self, var, zeta, precision):
1/sqrt(pi)*(1/2)^n*n^(-1/2) - 1/8/sqrt(pi)*(1/2)^n*n^(-3/2)
+ O((1/2)^n*n^(-5/2))
sage: G = GrowthGroup('log(x)^QQ')
sage: G(log(x))._singularity_analysis_(1, 'n', 5)
sage: G(log(x))._singularity_analysis_('n', 1, precision=5)
n^(-1) + O(n^(-3))
sage: G(log(x)^2)._singularity_analysis_(2, 'n', 3)
sage: G(log(x)^2)._singularity_analysis_('n', 2, precision=3)
8*(1/2)^n*n^(-1)*log(n) + 8*euler_gamma*(1/2)^n*n^(-1)
+ O((1/2)^n*n^(-2)*log(n)^2)
Expand All @@ -2896,7 +2896,7 @@ def _singularity_analysis_(self, var, zeta, precision):
NotImplementedError: singularity analysis not implemented
for non-integer exponent 1/2 of log(x)
sage: G = GrowthGroup('log(log(x))^QQ')
sage: G(log(log(x))^(1/2))._singularity_analysis_('n', 3)
sage: G(log(log(x))^(1/2))._singularity_analysis_('n', 2, precision=3)
Traceback (most recent call last):
...
NotImplementedError: singularity analysis not implemented
Expand Down
22 changes: 11 additions & 11 deletions src/sage/rings/asymptotic/growth_group_cartesian.py
Original file line number Diff line number Diff line change
Expand Up @@ -1190,16 +1190,16 @@ def _substitute_(self, rules):
from misc import substitute_raise_exception
substitute_raise_exception(self, e)

def _singularity_analysis_(self, zeta, var, precision):
def _singularity_analysis_(self, var, zeta, precision):
r"""
Perform singularity analysis on this growth element.
INPUT:
- ``zeta`` -- a number
- ``var`` -- a string denoting the variable
- ``zeta`` -- a number
- ``precision`` -- an integer
OUTPUT:
Expand All @@ -1212,32 +1212,32 @@ def _singularity_analysis_(self, zeta, var, precision):
sage: from sage.rings.asymptotic.growth_group import GrowthGroup
sage: G = GrowthGroup('exp(x)^QQ * x^QQ * log(x)^QQ')
sage: G(x^(1/2))._singularity_analysis_(2, 'n', 2)
sage: G(x^(1/2))._singularity_analysis_('n', 2, precision=2)
1/sqrt(pi)*(1/2)^n*n^(-1/2) - 1/8/sqrt(pi)*(1/2)^n*n^(-3/2)
+ O((1/2)^n*n^(-5/2))
sage: G(log(x))._singularity_analysis_(1, 'n', 5)
sage: G(log(x))._singularity_analysis_('n', 1, precision=5)
n^(-1) + O(n^(-3))
sage: G(x*log(x))._singularity_analysis_(1, 'n', 5)
sage: G(x*log(x))._singularity_analysis_('n', 1, precision=5)
log(n) + euler_gamma + 1/2*n^(-1) + O(n^(-2))
TESTS::
sage: G('exp(x)*log(x)')._singularity_analysis_(1, 'n', 5)
sage: G('exp(x)*log(x)')._singularity_analysis_('n', 1, precision=5)
Traceback (most recent call last):
...
NotImplementedError: singularity analysis of
exp(x)*log(x) not implemented
sage: G('exp(x)*x*log(x)')._singularity_analysis_(1, 'n', 5)
sage: G('exp(x)*x*log(x)')._singularity_analysis_('n', 1, precision=5)
Traceback (most recent call last):
...
NotImplementedError: singularity analysis for more
than two factors not yet implemented
sage: G(1)._singularity_analysis_(2, 'n', 3)
sage: G(1)._singularity_analysis_('n', 2, precision=3)
Traceback (most recent call last):
...
NotImplementedOZero: The error term in the result is O(0)
which means 0 for sufficiently large n.
sage: G('exp(x)')._singularity_analysis_(2, 'n', 3)
sage: G('exp(x)')._singularity_analysis_('n', 2, precision=3)
Traceback (most recent call last):
...
NotImplementedError: singularity analysis not implemented
Expand All @@ -1250,7 +1250,7 @@ def _singularity_analysis_(self, zeta, var, precision):
raise NotImplementedOZero(var=var)
elif len(factors) == 1:
return factors[0]._singularity_analysis_(
zeta=zeta, var=var, precision=precision)
var=var, zeta=zeta, precision=precision)
elif len(factors) == 2:
from growth_group import MonomialGrowthGroup
from sage.rings.integer_ring import ZZ
Expand Down

0 comments on commit 866a9e3

Please sign in to comment.