Precision guarantee with evalf

12 views
Skip to first unread message

Marc Pegon

unread,
Sep 24, 2025, 12:53:59 PM (yesterday) Sep 24
to sympy
Hi everyone,

First I'd like to thank the contributors to this project.

I'm writing here because there is a question I couldn't find a clear answer neither on the online doc nor in the pdf doc concerning error propagation when using evalf.

The doc says that that you can evaluate an expression to arbitrary precision by specifying n, increasing maxn if necessary, and setting strict=True. Even if the required precision is not reached, does evalf ensure that the printed digits are indeed the right digits in the decimal representation of the real number? Also, I wonder whether setting strict=True *guarantees* that the asked precision n is reached if PrecisionExhausted is not raised. If so, the next question is: how does evalf propagates errors? Does it involve interval arithmetic and how does that work with huge expressions involving a large sum of terms with products, irrational constants and special functions?

Basically, I'm wondering if sympy can be used to prove/certify inequalities.

I'm sorry if this question has already been asked and answered, but I couldn't find it precisely.

Thanks!

Marc

Donaldson Tan

unread,
Sep 24, 2025, 11:35:49 PM (18 hours ago) Sep 24
to sympy

pi.evalf(5) gives you 3.1416

pi.evalf(10) gives you 3.141592654

Marc P.

unread,
3:44 AM (14 hours ago) 3:44 AM
to sy...@googlegroups.com
Thanks Donaldson Tan, but this does not really answer my question. I'm thinking about evaluation complicated expressions involving huge sums of products of special functions taken at irrational points, where errors propagate, not just giving the n-th first digits of pi or of an already implemented standard special function

Best,

Marc

--
You received this message because you are subscribed to a topic in the Google Groups "sympy" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sympy/MLvgspTMQ9U/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sympy+un...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/sympy/78257cf4-cf34-4b8d-8e48-f6ce9ecd189fn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages