[sympy] How to control the order of terms in an expression when latexed

2018-03-30 Thread Wynne
Hi, I use SymPy in a learning system so the exact way expressions are printed is important. In a nutshell, the expression 1+x is always printed as x+1. Without jumping through hoops, is there a way to preserve the order of terms that corresponds to the way the expression was entered/built?

[sympy] Re: is something wrong with evaluation of Rationals?

2018-03-30 Thread Chris Smith
should 'rational with prec+4' be `prec+5'? It would take at most 5 binary digits to get you to the next decimal digit, wouldn't it? On Friday, March 30, 2018 at 1:37:57 AM UTC-5, Chris Smith wrote: > > Is this expected behavior for evaluating Rationals: > > Rational of a string produces the

Re: [sympy] is something wrong with evaluation of Rationals?

2018-03-30 Thread Isuru Fernando
Part of it is a bug and part of it is a feature. First the bug, https://github.com/sympy/sympy/blob/7524499458cf114b32e 3aa6e8acdb77e846111f9/sympy/core/evalf.py#L1264 needs to be changed. It should be changed from from_rational(x.p, x.q, prec) to from_rational(x.p, x.q, prec, rnd). Otherwise

[sympy] is something wrong with evaluation of Rationals?

2018-03-30 Thread Chris Smith
Is this expected behavior for evaluating Rationals: Rational of a string produces the exact decimal as a fraction: >>> Rational('.975159') 975159/100 evaluation is going to be affected by rounding >>> Rational('.975158').n(2) 0.97 >>> Rational('.975159').n(2) 0.98 But why is the digit