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

Commit

Permalink
Trac #19306: Fix low precision for Stirling
Browse files Browse the repository at this point in the history
  • Loading branch information
cheuberg committed Jan 15, 2016
1 parent a3fad56 commit a4c3f9d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/sage/rings/asymptotic/asymptotic_expansion_generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def Stirling(var, precision=None, skip_constant_factor=False):
- ``var`` -- a string for the variable name.
- ``precision`` -- (default: ``None``) an integer. If ``None``, then
- ``precision`` -- (default: ``None``) an integer `\ge 3`. If ``None``, then
the default precision of the asymptotic ring is used.
- ``skip_constant_factor`` -- (default: ``False``) a
Expand Down Expand Up @@ -144,7 +144,15 @@ def Stirling(var, precision=None, skip_constant_factor=False):
sage: asymptotic_expansions.Stirling('m', precision=4)
sqrt(2)*sqrt(pi)*e^(m*log(m))*(e^m)^(-1)*m^(1/2) +
O(e^(m*log(m))*(e^m)^(-1)*m^(-1/2))
sage: asymptotic_expansions.Stirling('m', precision=3)
O(e^(m*log(m))*(e^m)^(-1)*m^(1/2))
sage: asymptotic_expansions.Stirling('m', precision=2)
Traceback (most recent call last):
...
ValueError: precision must be at least 3
"""
if precision <= 2:
raise ValueError("precision must be at least 3")
log_Stirling = AsymptoticExpansionGenerators.log_Stirling(
var, precision=precision, skip_constant_summand=True)

Expand Down

0 comments on commit a4c3f9d

Please sign in to comment.