Opened 3 years ago

Last modified 5 months ago

#21659 needs_work defect

AsymptoticRing.coefficients_of_generating_function: hardcoded exponents in QQ

Reported by: cheuberg Owned by:
Priority: major Milestone: sage-7.4
Component: asymptotic expansions Keywords: singularity analysis
Cc: behackl, dkrenn Merged in:
Authors: Clemens Heuberger Reviewers:
Report Upstream: N/A Work issues: remove fix for QQbar(1/2)
Branch: u/dkrenn/21659/singularity-analysis-qqbar (Commits) Commit: 71af37801a7ec5ababcbb54e2b24f6bc8321e80b
Dependencies: #21963 Stopgaps:

Description

The method AsymptoticRing.coefficients_of_generating_function enforces exponents to be in QQ:

sage: R.<n> = AsymptoticRing('n^QQbar', QQbar)
sage: R.coefficients_of_generating_function(lambda z: (1-z)^(1/2), [1], 1)
-1/2/sqrt(pi)*n^(-3/2) + O(n^(-5/2))
sage: R.coefficients_of_generating_function(lambda z: (1-z)^QQbar(sqrt(2)), [1], 1)
Traceback (most recent call last):
...
ValueError: Cannot include T^(-1.414213562373095?) with parent Exact Term Monoid
T^(Algebraic Field) * log(T)^(Algebraic Field) with coefficients in Symbolic
Ring in Asymptotic Ring <T^QQ * log(T)^QQ> over Symbolic Ring
> *previous* ValueError: T^(-1.414213562373095?) is not in Growth Group T^QQ * log(T)^QQ

The problem is that the singular expansion is always constructed in

A = AsymptoticRing('T^QQ * log(T)^QQ', coefficient_ring=SR,
                   default_prec=precision)

Change History (6)

comment:1 Changed 3 years ago by cheuberg

  • Branch set to u/cheuberg/21659/singularity-analysis-qqbar

comment:2 follow-up: Changed 3 years ago by cheuberg

  • Authors set to Clemens Heuberger
  • Commit set to 382abb8973956a6816e199d20016966959f37c6c
  • Status changed from new to needs_review

Here is a first version of a fix. Unfortunately, some workaround is needed due to the fact that gamma(QQbar(1/2)) does not work, see post on sage-devel.

What I do not understand is that

sage: B.<n> = AsymptoticRing('n^QQbar', SR)
sage: B.coefficients_of_generating_function(
....:     lambda z: (1-z)^QQbar(sqrt(2)), [1], precision=1, exponent_ring=QQbar)
0.384695296551923*n^(-2.414213562373095?) + O(n^(-3.414213562373095?))

works but

sage: B.<n> = AsymptoticRing('QQbar^n * n^QQbar', SR)
sage: B.coefficients_of_generating_function(
....:     lambda z: (1-z)^QQbar(sqrt(2)), [1], precision=1, exponent_ring=QQbar)
Traceback (most recent call last)
...
TypeError: Cannot apply the substitution rules {Z: n} on 0.384695296551923*Z^(-2.414213562373095?) + 0.656715949434358*Z^(-3.414213562373095?) + 0.979573650974364*Z^(-4.414213562373095?) + O(Z^(-5.414213562373095?)) in Asymptotic Ring <Z^(Algebraic Field)> over Symbolic Ring.
> *previous* ValueError: Cannot substitute in 0.384695296551923*Z^(-2.414213562373095?) + 0.656715949434358*Z^(-3.414213562373095?) + 0.979573650974364*Z^(-4.414213562373095?) + O(Z^(-5.414213562373095?)) in Asymptotic Ring <Z^(Algebraic Field)> over Symbolic Ring.
>> *previous* ValueError: Cannot substitute in O(Z^(-5.414213562373095?)) in O-Term Monoid Z^(Algebraic Field) with implicit coefficients in Symbolic Ring.
>>> *previous* ValueError: Cannot substitute in Z^(-5.414213562373095?) in Growth Group Z^(Algebraic Field).
>>>> *previous* ValueError: Cannot take n to the exponent -5.414213562373095?.
>>>>> *previous* TypeError: no canonical coercion from Algebraic Field to Rational Field

does not.


New commits:

382abb8Trac #21659: Singularity Analysis with exponents from QQbar

comment:3 in reply to: ↑ 2 Changed 3 years ago by cheuberg

Replying to cheuberg:

What I do not understand is that

sage: B.<n> = AsymptoticRing('n^QQbar', SR)
sage: B.coefficients_of_generating_function(
....:     lambda z: (1-z)^QQbar(sqrt(2)), [1], precision=1, exponent_ring=QQbar)
0.384695296551923*n^(-2.414213562373095?) + O(n^(-3.414213562373095?))

works but

sage: B.<n> = AsymptoticRing('QQbar^n * n^QQbar', SR)
sage: B.coefficients_of_generating_function(
....:     lambda z: (1-z)^QQbar(sqrt(2)), [1], precision=1, exponent_ring=QQbar)
Traceback (most recent call last)
...
TypeError: Cannot apply the substitution rules {Z: n} on 0.384695296551923*Z^(-2.414213562373095?) + 0.656715949434358*Z^(-3.414213562373095?) + 0.979573650974364*Z^(-4.414213562373095?) + O(Z^(-5.414213562373095?)) in Asymptotic Ring <Z^(Algebraic Field)> over Symbolic Ring.
> *previous* ValueError: Cannot substitute in 0.384695296551923*Z^(-2.414213562373095?) + 0.656715949434358*Z^(-3.414213562373095?) + 0.979573650974364*Z^(-4.414213562373095?) + O(Z^(-5.414213562373095?)) in Asymptotic Ring <Z^(Algebraic Field)> over Symbolic Ring.
>> *previous* ValueError: Cannot substitute in O(Z^(-5.414213562373095?)) in O-Term Monoid Z^(Algebraic Field) with implicit coefficients in Symbolic Ring.
>>> *previous* ValueError: Cannot substitute in Z^(-5.414213562373095?) in Growth Group Z^(Algebraic Field).
>>>> *previous* ValueError: Cannot take n to the exponent -5.414213562373095?.
>>>>> *previous* TypeError: no canonical coercion from Algebraic Field to Rational Field

does not.

This is independent of singularity analysis; see #21665.

comment:4 Changed 3 years ago by cheuberg

  • Dependencies set to #21963
  • Status changed from needs_review to needs_work
  • Work issues set to remove fix for QQbar(1/2)

The problem with QQbar(1/2) seems to be fixed in https://github.com/pynac/pynac/issues/201 , so wait for #21963.

comment:5 Changed 5 months ago by dkrenn

  • Branch changed from u/cheuberg/21659/singularity-analysis-qqbar to u/dkrenn/21659/singularity-analysis-qqbar

comment:6 Changed 5 months ago by dkrenn

  • Commit changed from 382abb8973956a6816e199d20016966959f37c6c to 71af37801a7ec5ababcbb54e2b24f6bc8321e80b

Merged in SageMath 8.6


New commits:

71af378Merge tag '8.6' into u/cheuberg/21659/singularity-analysis-qqbar
Note: See TracTickets for help on using tickets.