Can Sage do high-precision polynomial integration?

46 views
Skip to first unread message

Mike

unread,
Jun 6, 2013, 3:28:52 PM6/6/13
to sage-s...@googlegroups.com
Is it possible (in Sage 5.9) to do high-precision simple integration (e.g. of polynomials)?

The following is an example of what doesn't work: while the coefficients of q are known to 30 digits, the coefficients of the integrals are known to at most 15.

a=RealField(100)(2)/3
q=a*x+a
print q
print q.integral(x, algorithm='maxima')
print q.integral(x, algorithm='sympy')

OUTPUT:
0.66666666666666666666666666667*x + 0.66666666666666666666666666667
0.333333333333*x^2 + 0.666666666667*x
0.333333333333333*x^2 + 0.666666666666667*x

leif

unread,
Jun 6, 2013, 7:06:47 PM6/6/13
to sage-s...@googlegroups.com
sage: R.<x>=RealField(100)[]
sage: a = 2/3
sage: f = a*x + a
sage: f.integral()
0.33333333333333333333333333333*x^2 + 0.66666666666666666666666666667*x
sage: R.<x>=RealField(200)[]
sage: f = a*x + a
sage: f.integral()
0.33333333333333333333333333333333333333333333333333333333333*x^2 +
0.66666666666666666666666666666666666666666666666666666666667*x


-leif

--
() The ASCII Ribbon Campaign
/\ Help Cure HTML E-Mail

leif

unread,
Jun 6, 2013, 7:53:54 PM6/6/13
to sage-s...@googlegroups.com
P.S.:

To elaborate a bit more, note the difference:


sage: a = 2/3

sage: R.<x>=RealField(100)[]
sage: R
Univariate Polynomial Ring in x over Real Field with 100 bits of precision
sage: type(x)
sage.rings.polynomial.polynomial_real_mpfr_dense.PolynomialRealDense
sage: type(a*x+a)
sage.rings.polynomial.polynomial_real_mpfr_dense.PolynomialRealDense

sage: x=var('x')
sage: type(x)
sage.symbolic.expression.Expression
sage: type(a*x+a)
sage.symbolic.expression.Expression

Zimmermann Paul

unread,
Jun 7, 2013, 2:49:04 PM6/7/13
to sage-s...@googlegroups.com
you can also use Pari/GP and mpmath from Sage. See pages 312-314 of
<http://sagebook.gforge.inria.fr/>.

Paul Zimmermann
Reply all
Reply to author
Forward
0 new messages