Precision management for non-exact objects#
Manage the default precision for non-exact objects such as power series rings or Laurent series rings.
EXAMPLES:
sage: R.<x> = PowerSeriesRing(QQ)
sage: R.default_prec()
20
sage: cos(x)
1 - 1/2*x^2 + 1/24*x^4 - 1/720*x^6 + 1/40320*x^8 - 1/3628800*x^10 +
1/479001600*x^12 - 1/87178291200*x^14 + 1/20922789888000*x^16 -
1/6402373705728000*x^18 + O(x^20)
sage: R.<x> = PowerSeriesRing(QQ, default_prec=10)
sage: R.default_prec()
10
sage: cos(x)
1 - 1/2*x^2 + 1/24*x^4 - 1/720*x^6 + 1/40320*x^8 + O(x^10)
Note
Subclasses of Nonexact
which require to change the default
precision should implement a method set_default_prec
.
- class sage.structure.nonexact.Nonexact(prec=20)#
Bases:
object
A non-exact object with default precision.
INPUT:
prec
– a non-negative integer representing the default precision ofself
(default:20
)
- default_prec()#
Return the default precision for
self
.EXAMPLES:
sage: R = QQ[[x]] sage: R.default_prec() 20
sage: R.<x> = PowerSeriesRing(QQ, default_prec=10) sage: R.default_prec() 10