If you expect correct decimal arithmetic and rounding, it could be better look at the alternatives like decimal <https://docs.python.org/3/library/decimal.html> library. I don't think that there is any good unified library of combining arbitrary precision arithmetic with different rounding option yet, but it would not be more difficult to program straightforwardly from integers, if you want to experiment with customized decimal, rounding option, unless someone provides some encyclopedia.
On Friday, November 18, 2022 at 6:03:30 AM UTC+2 Jeremy Monat wrote: > Here's an example of using SymPy's lambdify() > <https://docs.sympy.org/dev/modules/utilities/lambdify.html#sympy.utilities.lambdify.lambdify> > > to convert a SymPy function to a numerical function that e.g. SciPy can > use: Numerically Solve an ODE in SciPy > <https://docs.sympy.org/dev/guides/solving/solve-ode.html#numerically-solve-an-ode-in-scipy> > > Best, > Jeremy Monat > > On Thu, Nov 17, 2022 at 9:28 PM Peter Stahlecker <peter.st...@gmail.com> > wrote: > >> My limited understanding of sympy is, that it is used for symbolic >> calculations. >> If you then want numerical calculations, is it not better to convert your >> sympy results to, say, numpy results ( using e.g. lambdify(..) )? Then you >> have the full power of numpy, scipy, etc. There is even a special library >> to handle calculations with floats having uncertainties. (This was >> mentioned earlier in this dialogue) >> >> On Fri 18. Nov 2022 at 04:17 'XR-7 RKE' via sympy <sy...@googlegroups.com> >> wrote: >> >>> Yes. This exactly. Oh. sadly sympy doesn't support :'( >>> >>> On Thursday, 17 November 2022 at 20:30:51 UTC+7 gu...@uwosh.edu wrote: >>> >>>> An alternative interpretation of your question is that you are asking >>>> if sympy is aware of the rules for propagating significant digits through >>>> calculations? The answer is no. You have to apply the rules yourself to >>>> decide appropriate rounding. >>>> >>>> Additional alternatives: 1) set up interval arithmetic to get a more >>>> precise version of the significant figures rules; 2) do full error >>>> propagation to determine uncertainties in your computations. >>>> >>>> Jonathan >>>> >>>> On Thursday, November 17, 2022 at 4:04:20 AM UTC-6 Oscar wrote: >>>> >>>>> The ordinary Python round function can do this: >>>>> https://docs.python.org/3/library/functions.html#round >>>>> >>>>> >>>>> On Thu, 17 Nov 2022 at 09:46, Peter Stahlecker <peter.st...@gmail.com> >>>>> wrote: >>>>> >>>>>> you might want to check floating point numbers in the sympy >>>>>> documentation. >>>>>> >>>>>> Am Do., 17. Nov. 2022 um 10:18 Uhr schrieb 'XR-7 RKE' via sympy < >>>>>> sy...@googlegroups.com>: >>>>>> >>>>>>> Hey guys, >>>>>>> >>>>>>> Does sympy support round a number to significant figures? >>>>>>> >>>>>>> [image: SCR-20221117-m64.png] >>>>>>> >>>>>>> -- >>>>>>> You received this message because you are subscribed to the Google >>>>>>> Groups "sympy" group. >>>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>>> send an email to sympy+un...@googlegroups.com. >>>>>>> To view this discussion on the web visit >>>>>>> https://groups.google.com/d/msgid/sympy/4f5ae36a-60fb-429b-8f7a-e00e5637853fn%40googlegroups.com >>>>>>> >>>>>>> <https://groups.google.com/d/msgid/sympy/4f5ae36a-60fb-429b-8f7a-e00e5637853fn%40googlegroups.com?utm_medium=email&utm_source=footer> >>>>>>> . >>>>>>> >>>>>> -- >>>>>> You received this message because you are subscribed to the Google >>>>>> Groups "sympy" group. >>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>> send an email to sympy+un...@googlegroups.com. >>>>>> >>>>> To view this discussion on the web visit >>>>>> https://groups.google.com/d/msgid/sympy/CABKqA0ZhnozwJfww-y8Q7u%3DwiTHgdZGouwc5Kmi4obj8ZwJ4Ww%40mail.gmail.com >>>>>> >>>>>> <https://groups.google.com/d/msgid/sympy/CABKqA0ZhnozwJfww-y8Q7u%3DwiTHgdZGouwc5Kmi4obj8ZwJ4Ww%40mail.gmail.com?utm_medium=email&utm_source=footer> >>>>>> . >>>>>> >>>>> -- >>> You received this message because you are subscribed to the Google >>> Groups "sympy" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to sympy+un...@googlegroups.com. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/sympy/b6d42512-d729-4d18-9aa1-540eb5a91d8cn%40googlegroups.com >>> >>> <https://groups.google.com/d/msgid/sympy/b6d42512-d729-4d18-9aa1-540eb5a91d8cn%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- >> Best regards, >> >> Peter Stahlecker >> >> -- >> You received this message because you are subscribed to the Google Groups >> "sympy" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to sympy+un...@googlegroups.com. >> > To view this discussion on the web visit >> https://groups.google.com/d/msgid/sympy/CABKqA0Y_GGrMHZO93qiECzhepJQA83E01GuNGE2_1%3D3h7U17zg%40mail.gmail.com >> >> <https://groups.google.com/d/msgid/sympy/CABKqA0Y_GGrMHZO93qiECzhepJQA83E01GuNGE2_1%3D3h7U17zg%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> > -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sympy+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/a51db5c0-b5c3-40e3-9276-f232b6714e74n%40googlegroups.com.