Am Freitag, 20. März 2015 19:13:12 UTC+1 schrieb Aaron Meurer: > > The S() function converts objects into SymPy objects, so S(0) converts > int(0) to sympy.Integer(0). It is completely redundant in this case, >
So you say one would better write 0 in the example? Wouldn't it then lead to better readability when the authors of http://docs.sympy.org/0.7.5/modules/solvers/inequalities.html use the 0 instead S(0). > as the 0 would be coerced automatically from the <= with the SymPy > expression x + 3. The S() function is typically only needed when > dividing integers, like S(1)/2, as 1/2 would be entirely Python, and > give a floating point number (or worse, in Python 2, integer > division). See > http://docs.sympy.org/latest/tutorial/gotchas.html#two-final-notes-and > for more information about this. > > Aaron Meurer > > On Fri, Mar 20, 2015 at 11:56 AM, Christoph Kukulies > <ku...@physik.rwth-aachen.de <javascript:>> wrote: > > Hi, > > > > I'm playing a bit with sympy and reduce_inequations while I'm stumbling > > about understanding a term: > > > > from sympy import Q, sympify as S > > from sympy.abc import x, y > > from sympy.solvers.inequalities import reduce_inequalities > > reduce_inequalities(S(0) <= x + 3, Q.real(x), []) > > > > What does S(0) mean here exactly? print S(0) gives me 0, so why not just > 0 > corrected typo that was in my OP (here) > > and why S(0)? > > > Christoph > > > -- 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 post to this group, send email to sympy@googlegroups.com. Visit this group at http://groups.google.com/group/sympy. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/596c6d8f-42c2-4f25-b1e9-c471dfc491e5%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.