@@ -1611,6 +1611,33 @@ def _singularity_analysis_(self, var, zeta, precision):
1611
1611
raise NotImplementedError ('singularity analysis of {} '
1612
1612
'not implemented ' .format (self ))
1613
1613
1614
+ def _find_minimum_ (self , valid_from ):
1615
+ r"""
1616
+ Find the minimum of this growth element over the range implied by ``valid_from``.
1617
+
1618
+ INPUT:
1619
+
1620
+ - ``valid_from`` -- a dictionary describing the range of the minimization:
1621
+ the keys are names of variables and the range is the intersection over
1622
+ the ranges where the absolute value of the variable designated by the
1623
+ key is at least the corresponding value
1624
+
1625
+ OUTPUT:
1626
+
1627
+ A number
1628
+
1629
+ TESTS::
1630
+
1631
+ sage: from sage.rings.asymptotic.growth_group import GenericGrowthGroup
1632
+
1633
+ sage: G = GenericGrowthGroup(ZZ)
1634
+ sage: G(raw_element=42)._find_minimum_(valid_from={'m': 10})
1635
+ Traceback (most recent call last):
1636
+ ...
1637
+ NotImplementedError: find minimum for GenericGrowthElement(42) not implemented
1638
+ """
1639
+ raise NotImplementedError (f'find minimum for { self } not implemented' )
1640
+
1614
1641
1615
1642
class GenericGrowthGroup (UniqueRepresentation , Parent , WithLocals ):
1616
1643
r"""
@@ -2779,6 +2806,35 @@ def __ne__(self, other):
2779
2806
return not self == other
2780
2807
2781
2808
2809
+ class DecreasingGrowthElementError (ValueError ):
2810
+ r"""
2811
+ A special :python:`ValueError<library/exceptions.html#exceptions.ValueError>`
2812
+ which is raised when a growth element is less than one.
2813
+
2814
+ INPUT:
2815
+
2816
+ - ``element`` -- a :class:`GenericGrowthElement`
2817
+
2818
+ The remaining arguments are passed on to
2819
+ :python:`ValueError<library/exceptions.html#exceptions.ValueError>`.
2820
+ """
2821
+ def __init__ (self , element , * args , ** kwds ):
2822
+ r"""
2823
+ See :class:`DecreasingGrowthElementError` for more information.
2824
+
2825
+ TESTS::
2826
+
2827
+ sage: from sage.rings.asymptotic.growth_group import DecreasingGrowthElementError, GenericGrowthElement, MonomialGrowthGroup
2828
+ sage: raise DecreasingGrowthElementError(
2829
+ ....: GenericGrowthElement(MonomialGrowthGroup(QQ, 'x'), 1/2), 'wrong value')
2830
+ Traceback (most recent call last):
2831
+ ...
2832
+ DecreasingGrowthElementError: wrong value
2833
+ """
2834
+ super ().__init__ (* args , ** kwds )
2835
+ self .element = element
2836
+
2837
+
2782
2838
class MonomialGrowthElement (GenericGrowthElement ):
2783
2839
r"""
2784
2840
An implementation of monomial growth elements.
@@ -3308,6 +3364,58 @@ def _singularity_analysis_(self, var, zeta, precision):
3308
3364
raise NotImplementedError (
3309
3365
'singularity analysis of {} not implemented' .format (self ))
3310
3366
3367
+ def _find_minimum_ (self , valid_from ):
3368
+ r"""
3369
+ Find the minimum of this growth element over the range implied by ``valid_from``.
3370
+
3371
+ INPUT:
3372
+
3373
+ - ``valid_from`` -- a dictionary describing the range of the minimization:
3374
+ the keys are names of variables and the range is the intersection over
3375
+ the ranges where the absolute value of the variable designated by the
3376
+ key is at least the corresponding value
3377
+
3378
+ OUTPUT:
3379
+
3380
+ A number
3381
+
3382
+ TESTS::
3383
+
3384
+ sage: from sage.rings.asymptotic.growth_group import MonomialGrowthGroup, GrowthGroup
3385
+
3386
+ sage: G = MonomialGrowthGroup(QQ, 'x')
3387
+ sage: G('x^3')._find_minimum_(valid_from={'x': 10})
3388
+ 1000
3389
+ sage: e1 = G(raw_element=3); e2 = G(raw_element=2)
3390
+ sage: e3 = e2 / e1
3391
+ sage: e3
3392
+ x^(-1)
3393
+ sage: e3._find_minimum_(valid_from={'x': 5})
3394
+ Traceback (most recent call last):
3395
+ ...
3396
+ DecreasingGrowthElementError: the growth of x^(-1) is less than one
3397
+ sage: H = GrowthGroup('log(x)^ZZ')
3398
+ sage: l1 = H(raw_element=2)
3399
+ sage: l1._find_minimum_(valid_from={'x': 5})
3400
+ Traceback (most recent call last):
3401
+ ...
3402
+ NotImplementedError: Minimum of log(x)^2 is not implemented
3403
+ sage: I = GrowthGroup('log(log(x))^ZZ')
3404
+ sage: l2 = I(raw_element=5)
3405
+ sage: l2._find_minimum_(valid_from={'x': 5})
3406
+ Traceback (most recent call last):
3407
+ ...
3408
+ NotImplementedError: Minimum of log(log(x))^5 is not implemented
3409
+ """
3410
+ if not self .parent ().gens_monomial ():
3411
+ raise NotImplementedError (f'Minimum of { self } is not implemented' )
3412
+ if self .is_lt_one ():
3413
+ raise DecreasingGrowthElementError (self , f'the growth of { self } is less than one' )
3414
+ elif self .is_one ():
3415
+ return 1
3416
+ assert self .variable_names (), f'{ self .variable_names ()} is empty'
3417
+ return valid_from [self .variable_names ()[0 ]] ** self .exponent
3418
+
3311
3419
3312
3420
class MonomialGrowthGroup (GenericGrowthGroup ):
3313
3421
r"""
0 commit comments