-
-
Notifications
You must be signed in to change notification settings - Fork 665
Closed
Labels
Description
As in the title. Currently we have the following supported
sage: %xmode Minimal
Exception reporting mode: Minimal
sage: 1/0
ZeroDivisionError: rational division by zero
sage: R.<x> = LazyPowerSeriesRing(QQ)
sage: R(sqrt(x+1)-1)
1/2*x - 1/8*x^2 + 1/16*x^3 - 5/128*x^4 + 7/256*x^5 - 21/1024*x^6 + O(x^7)
sage: R(sqrt(x+1)-1).compositional_inverse()
2*x + x^2 + O(x^8)
sage: R(sqrt(x+1)-1).revert()
2*x + x^2 + O(x^8)
sage: R(sqrt(x+1)-1).revert_series()
AttributeError: 'LazyPowerSeriesRing_with_category.element_class' object has no attribute 'revert_series'
sage: R.<x> = QQ[[]]
sage: R(sqrt(x+1)-1)
1/2*x - 1/8*x^2 + 1/16*x^3 - 5/128*x^4 + 7/256*x^5 - 21/1024*x^6 + 33/2048*x^7 - 429/32768*x^8 + 715/65536*x^9 - 2431/262144*x^10 + 4199/524288*x^11 - 29393/4194304*x^12 + 52003/8388608*x^13 - 185725/33554432*x^14 + 334305/67108864*x^15 - 9694845/2147483648*x^16 + 17678835/4294967296*x^17 - 64822395/17179869184*x^18 + 119409675/34359738368*x^19 + O(x^20)
sage: R(sqrt(x+1)-1).compositional_inverse()
AttributeError: 'sage.rings.power_series_poly.PowerSeries_poly' object has no attribute 'compositional_inverse'
sage: R(sqrt(x+1)-1).polynomial().revert_series(10)
x^2 + 2*x
sage: var("x")
x
sage: f = (sqrt(x+1)-1).function(x); f
x |--> sqrt(x + 1) - 1
sage: f.compositional_inverse()
AttributeError: 'sage.symbolic.expression.Expression' object has no attribute 'compositional_inverse'
The last ought to work and return the symbolic function x |--> x^2+2*x
.
There is #11202 but the proposed interface there appears rather unnatural. I think compositional_inverse()
for a single variable is straightforward interface.