Hi fans of sympy, often when I am using sympy I accidentally just type "1/2" to mean one half. All of you know that sympy does not like that... So I asked myself, does it need to be like that? So I played around a bit with the Python interpreter, and just made integer divisions return fractions instead of floats. That should keep everybody happy: fractions can easily be converted to floats, they actually are automatically converted in most cases, but still sympy happily can do symbolic math!
My prototype can be found here: https://github.com/tecki/cpython/tree/int-divide-fraction I presented my idea at python-ideas here: https://mail.python.org/archives/list/[email protected]/thread/RM4JDTGQCOW3MGIKIGEP2BIFOTFFAZI4/ Maybe somebody is interested and would like to contribute to the discussion. To show how it all looks like, here an example interaction (this is the running interpreter with bare sympy, no modifications were necessary): >>> from sympy import symbols, sqrt, sin >>> x = symbols("x") >>> sin(1/2) sin(1/2) >>> 1/2 + x x + 1/2 >>> 2/3 * x 2*x/3 >>> sqrt(1/4) 1/2 Cheers Martin -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/a8836626-dc1a-4c14-9c36-7b30672d5b3en%40googlegroups.com.
