Giter Club home page Giter Club logo

diofant's Introduction

diofant's People

Contributors

addisonc avatar asmeurer avatar catchmrbharath avatar cbm755 avatar certik avatar debugger22 avatar ellisonbg avatar flacjacket avatar fredrik-johansson avatar gilbertgede avatar jcrist avatar jegerjensen avatar jrioux avatar krastanov avatar kundankrmodi avatar mattpap avatar moorepants avatar navytux avatar pernici avatar rlamy avatar rpmuller avatar saptman avatar scolobb avatar skirpichev avatar smichr avatar srjoglekar246 avatar thilinarmtb avatar twmr avatar vks avatar vperic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

diofant's Issues

Can't do integrate((2 - x)**a*sin(a/x), (x, 0, 2))

In [1]: from diofant import *

In [2]: x = Symbol('x')

In [3]: alpha = Symbol('alpha', positive=True)

In [4]: integrate((2 - x)**alpha*sin(alpha/x), (x, 0, 2))
Out[4]: 
2                    
⌠                    
⎮         αα⎞   
⎮ (-x + 2) ⋅sin⎜─⎟ dx
⎮              ⎝x⎠   
⌡                    
0                    

And example from this ref.

PS: Perhaps it's a bug somewhere in the meijerint_definite.

classify_sysode should be modified to support mass matrix case in LODE

In [1]: x, y, z = symbols('x, y, z', cls=Function)

In [2]: t = symbols('t')

In [3]: eqs = (-x(t) + Derivative(x(t), t) + Derivative(y(t), t), y(t) + Derivative(x(t), t) - Derivative(y(t), t))

In [4]: dsolve(eqs)
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-3-66d52b90334b> in <module>()
----> 1 dsolve(eqs)

/home/sk/src/diofant/sympy/solvers/ode.py in dsolve(eq, func, hint, simplify, ics, xi, eta, x0, n, **kwargs)
    576     """
    577     if iterable(eq):
--> 578         match = classify_sysode(eq, func)
    579         eq = match['eq']
    580         order = match['order']

/home/sk/src/diofant/sympy/solvers/ode.py in classify_sysode(eq, funcs, **kwargs)
   1445         if matching_hints['is_linear']:
   1446             if order_eq == 1:
-> 1447                 type_of_equation = check_linear_neq_order1(eq, funcs, func_coef)
   1448 
   1449             if type_of_equation is None:

/home/sk/src/diofant/sympy/solvers/ode.py in check_linear_neq_order1(eq, func, func_coef)
   1708     n = len(eq)
   1709     fc = func_coef
-> 1710     t = func[0].args[0]
   1711 
   1712     M = Matrix(n, n, lambda i, j: +fc[i, func[j], 1])

AttributeError: 'list' object has no attribute 'args'

Wrong rsolve(f(n)-f(n-1)-2*f(n-2)-2*n, f(n))

In [3]: rsolve(f(n)-f(n-1)-2*f(n-2)-2*n, f(n))
Out[3]: 
    n       n                  
(-1) ⋅C₀ + 2 ⋅C₁ + C₀⋅(2⋅n + 4)

c.f. Mathematica:

In[1]:= RSolve[-2*n + f[n] - 2*f[n - 2] - f[n - 1]==0, f[n], n]
RSolve[-2*n + f[n] - 2*f[n - 2] - f[n - 1]==0, f[n], n]
Out[1]= 
          -5 - 2 n       n         n
{{f[n] -> -------- + (-1)  C[1] + 2  C[2]}}
             2

See sympy/sympy#11261 (where wrong answer for IVP was reported).

Perhaps, it's the same problem as in the sympy/sympy#7055 (wrong extra linear term, shouldn't have C₀ here).

Wrong automatical cancellation of expr with O terms

And example:

In [1]: sin(x+O(x**2))
Out[1]: 
   ⎛     ⎛ 2⎞⎞
sinx + Ox ⎠⎠

In [2]: sin(x+O(x**2)) - sin(x+O(x**2))
Out[2]: 0

In [3]: sin(O(x))/sin(O(x))
Out[3]: 1

See also this thread and sympy/sympy#6737.

Mathematica does same stupid things

In[2]:= Sin[O[x]]
Out[2]= 
O[x]
In[3]:= O[x]-O[x]
Out[3]= 
O[x]
In[4]:= Hold[Sin[O[x]]]
Out[4]= 
Hold[Sin[O[x]]]
In[5]:= Hold[Sin[O[x]]]-Hold[Sin[O[x]]]
Out[5]= 
0

assumptions todo

Make old and new systems consistent, see e.g. sympy/sympy#8134. All old assumptions should be in the new system.

  • is_real vs Q.real & Q.extended_real (#36)
  • is_finite/is_infinite vs Q.bounded (#40, #41)
  • is_nonzero/Q.nonzero (#80)
  • Float in the new assumptions, see sympy/sympy#9670

For old assumptions:

  • complex -> finite (#42)
  • manually check all assumption handlers (_eval_is_*): 1) be correct 2) be covered with tests. #316
    • diofant/concrete/expr_with_limits.py
    • diofant/concrete/products.py
    • diofant/concrete/summations.py
    • diofant/core/add.py
    • diofant/core/expr.py
    • diofant/core/function.py
    • diofant/core/mod.py
    • diofant/core/mul.py
    • diofant/core/numbers.py
    • diofant/core/power.py
    • diofant/functions/combinatorial/factorials.py
    • diofant/functions/combinatorial/numbers.py
    • diofant/functions/elementary/complexes.py
    • diofant/functions/elementary/exponential.py
    • diofant/functions/elementary/hyperbolic.py
    • diofant/functions/elementary/integers.py
    • diofant/functions/elementary/piecewise.py
    • diofant/functions/elementary/trigonometric.py
    • diofant/functions/special/bessel.py
    • diofant/functions/special/error_functions.py
    • diofant/functions/special/gamma_functions.py
    • diofant/integrals/integrals.py
    • diofant/matrices/expressions/matadd.py
    • diofant/matrices/expressions/matmul.py
    • diofant/matrices/expressions/matpow.py
    • diofant/ntheory/factor_.py
    • diofant/polys/rootoftools.py
    • diofant/series/order.py
    • diofant/stats/rv.py
  • same for explicit assumption properties, e.g. is_real = True. #334
  • Move old assumptions from Basic to Expr (sympy/sympy#7214) #311
  • document all assumption properties in core/assumptions.py #331, #354

(meta issue)

minimal_polynomial sometimes is slow for very simple expressions

For example, this is a regression problem (see test_contains from test_sets.py):

In [1]: rad1 = Pow(Pow(2, Rational(1, 3)) - 1, Rational(1, 3))

In [2]: rad2 = (Pow(Rational(1, 9), Rational(1, 3)) -
   ...:         Pow(Rational(2, 9), Rational(1, 3)) +
   ...:         Pow(Rational(4, 9), Rational(1, 3)))

In [3]: e = rad1 - rad2

In [4]: e.args
Out[4]: 
  3 ___   3 ___    2/3 3 ___      ____________
 -\/ 3    \/ 6   -2   *\/ 3    3 /      3 ___
(-------, -----, ------------, \/  -1 + \/ 2  )
    3       3         3

In [5]: a,b,c,d = e.args

In [6]: %time minimal_polynomial(Add(d, a, b, c, evaluate=False))
CPU times: user 532 ms, sys: 4 ms, total: 536 ms
Wall time: 681 ms
Out[6]: x

In [7]: %time minimal_polynomial(e)
CPU times: user 54.7 s, sys: 508 ms, total: 55.2 s
Wall time: 1min 17s
Out[7]: x

This was broken due to different ordering in Add after 73027a6. Meanwhile we should
replace test for issue 8209 with a more simple version.

Remove unsupported and obsoleted modules

  • physics (this stuff hasn't enough reviewers even in the sympy, esp. physics/quantum), some generic stuff can be moved to other places, e.g. gamma matrices from hep. #23
  • crypto (suggest https://cryptography.io/ ?) #102
  • pyglet plotting (#50)
  • galgebra (see e.g. sympy/sympy#8365) #45
  • py.test fork (see #22)
  • sympy/parsing/sympy_tokenize.py (do we need sympify() stuff at all?) #120
  • sympy/plotting/textplot.py (make sense as a matplotlib backend) #67
  • sympy/series/acceleration.py (similar methods in mpmath) #69
  • sympy/series/kauers.py ? #69
  • sage support (not tested in sympy anyway!) #84
  • py.bench #85
  • unify (not used) #88
  • strategies (unbundle!) #103
  • sympy/utilities/mathml/data #114
  • sympy/ntheory/bbp_pi.py #104

(meta issue)

Remove obsoleted/redundant docs

(meta issue)

Trivial limit's of sign fails

In [1]: limit(sign(ln(x)), x, 1, '+')
Out[1]: 1

In [2]: limit(sign(ln(x)), x, 1, '-')  # should be -1
Out[2]: 0

In [3]: limit(sign(sin(x)), x, 0, '+')  # should be 1
Out[3]: 0

In [4]: limit(sign(sin(x)), x, 0, '-')  # should be -1
Out[4]: 0

In [5]: limit(sign(tan(x)), x, 0, '+')  # should be 1
Out[5]: 0

In [6]: limit(sign(tan(x)), x, 0, '-')  # should be -1
Out[6]: 0

In [7]: limit(sign(cos(x)), x, pi/2, '+')  # should be -1
Out[7]: 0

In [8]: limit(sign(cos(x)), x, pi/2, '-')  # should be 1
Out[8]: 0

https://groups.google.com/d/msg/sympy/tY1mPLwGJnc/i6mN90tucFAJ

FiniteSet with symbolic elements and subs

In [1]: len(FiniteSet(x, y))
Out[1]: 2
In [2]: for i in FiniteSet(x, y):
   ...:     print(i)
   ...: 
x
y
In [3]: len(FiniteSet(x, y).subs({x: 1, y: 1}))
Out[3]: 1

Perhaps, we should iterate over FiniteSet only if it contains non-Symbols, see #112.

Or we can ensure that for any x and y in set: (x-y).is_zero is not True and keep this also in .subs() (e.g. above In[3] will raise an error, ValueError?).

Incorrect nseries for cos(x**6)

In [12]: cos(x**6).nseries(x, n=15)
Out[12]: 
     ⎛ 15⎞
1 + O⎝x  ⎠

In [13]: cos(x**6).nseries(x, n=16)
Out[13]: 
     12         
    x      ⎛ 16⎞
1 - ─── + O⎝x  ⎠
     2          

See sympy/sympy#10503.

Perhaps, the reason - is in the Augean stables of code in Function._eval_nseries.

Evalf can increase prec for Floats!

Probably we should keep Floats for input/output only. For example, multiple precision
math with Floats currently doesn't have any sense. Too easy get a wrong answer:

In [1]: n = sin(1)**2 + cos(1)**2 - 1
In [2]: f = n.evalf()
In [3]: f
Out[3]: -0.e-124
In [4]: f._prec
Out[4]: 1
In [5]: f2 = f.evalf()
In [6]: f2
Out[6]: -3.78182804184504e-124
In [7]: f2._prec
Out[7]: 53

@smichr, I think you are most knowledgeable person for evalf module. Do you think it's an issue for Sympy?!

Random MemoryError in test_gruntz_eval_special

Traceback:

___________________________ test_gruntz_eval_special ___________________________

    @pytest.mark.slow
    def test_gruntz_eval_special():
        # Gruntz, p. 126
        assert gruntz(exp(x)*(sin(1/x + exp(-x)) - sin(1/x + exp(-x**2))), x) == 1
        assert gruntz((erf(x - exp(-exp(x))) - erf(x)) * exp(exp(x)) * exp(x**2),
                      x) == -2/sqrt(pi)
        assert gruntz(exp(exp(x)) * (exp(sin(1/x + exp(-exp(x)))) - exp(sin(1/x))),
                      x) == 1
        assert gruntz(exp(x)*(gamma(x + exp(-x)) - gamma(x)), x) == oo
        assert gruntz(exp(exp(digamma(digamma(x))))/x, x) == exp(-Rational(1, 2))
        assert gruntz(exp(exp(digamma(log(x))))/x, x) == exp(-Rational(1, 2))
        assert gruntz(digamma(digamma(digamma(x))), x) == oo
        assert gruntz(loggamma(loggamma(x)), x) == oo
        assert gruntz(((gamma(x + 1/gamma(x)) - gamma(x))/log(x) - cos(1/x))
                      * x*log(x), x) == -Rational(1, 2)
        assert gruntz(x * (gamma(x - 1/gamma(x)) - gamma(x) + log(x)), x) \
            == Rational(1, 2)
        assert gruntz((gamma(x + 1/gamma(x)) - gamma(x)) / log(x), x) == 1
        assert gruntz(gamma(x + 1)/sqrt(2*pi)
                      - exp(-x)*(x**(x + Rational(1, 2)) + x**(x - Rational(1, 2))/12), x) == oo
>       assert gruntz(exp(exp(exp(digamma(digamma(digamma(x))))))/x, x) == 0

sympy/series/tests/test_gruntz.py:107: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../virtualenv/python3.4.2/lib/python3.4/site-packages/cachetools/__init__.py:50: in wrapper
    v = func(*args, **kwargs)
sympy/series/gruntz.py:231: in limitinf
    c0, e0 = mrv_leadterm(e, x)
../../../virtualenv/python3.4.2/lib/python3.4/site-packages/cachetools/__init__.py:50: in wrapper
    v = func(*args, **kwargs)
sympy/series/gruntz.py:281: in mrv_leadterm
    e, logw = rewrite(e, x, w)
sympy/series/gruntz.py:321: in rewrite
    Omega = mrv(e, x)
sympy/series/gruntz.py:139: in mrv
    return mrv_max(mrv(a, x), mrv(b, x), x)
sympy/series/gruntz.py:144: in mrv
    elif any(a.is_infinite for a in Mul.make_args(limitinf(e.exp, x))):
../../../virtualenv/python3.4.2/lib/python3.4/site-packages/cachetools/__init__.py:50: in wrapper
    v = func(*args, **kwargs)
sympy/series/gruntz.py:240: in limitinf
    return limitinf(c0, x)
../../../virtualenv/python3.4.2/lib/python3.4/site-packages/cachetools/__init__.py:50: in wrapper
    v = func(*args, **kwargs)
sympy/series/gruntz.py:231: in limitinf
    c0, e0 = mrv_leadterm(e, x)
../../../virtualenv/python3.4.2/lib/python3.4/site-packages/cachetools/__init__.py:50: in wrapper
    v = func(*args, **kwargs)
sympy/series/gruntz.py:283: in mrv_leadterm
    lt = e.compute_leading_term(w, logx=logw)
sympy/core/expr.py:2811: in compute_leading_term
    is_zero = t.equals(0)
sympy/core/expr.py:616: in equals
    constant = diff.is_constant(simplify=False, failing_number=True)
sympy/core/expr.py:545: in is_constant
    if b is not None and b is not S.NaN and b.equals(a) is False:
sympy/core/expr.py:604: in equals
    diff = factor_terms((self - other).simplify(), radical=True)
sympy/core/expr.py:3033: in simplify
    return simplify(self, ratio, measure)
sympy/simplify/simplify.py:607: in simplify
    _e = cancel(expr)
sympy/polys/polytools.py:6201: in cancel
    c, P, Q = F.cancel(G)
sympy/polys/polytools.py:3428: in cancel
    result = F.cancel(G, include=include)
sympy/polys/polyclasses.py:681: in cancel
    cF, cG, F, G = dmp_cancel(F, G, lev, dom, include=False)
sympy/polys/euclidtools.py:1844: in dmp_cancel
    _, p, q = dmp_inner_gcd(f, g, u, K)
sympy/polys/euclidtools.py:1561: in dmp_inner_gcd
    h, cff, cfg = _dmp_inner_gcd(f, g, u, K)
sympy/polys/euclidtools.py:1509: in _dmp_inner_gcd
    f = dmp_convert(f, u, K, exact)
sympy/polys/densebasic.py:516: in dmp_convert
    return dmp_strip([ dmp_convert(c, v, K0, K1) for c in f ], u)
sympy/polys/densebasic.py:516: in <listcomp>
    return dmp_strip([ dmp_convert(c, v, K0, K1) for c in f ], u)
sympy/polys/densebasic.py:510: in dmp_convert
    return dup_convert(f, K0, K1)
sympy/polys/densebasic.py:489: in dup_convert
    return dup_strip([ K1.convert(c, K0) for c in f ])
sympy/polys/densebasic.py:489: in <listcomp>
    return dup_strip([ K1.convert(c, K0) for c in f ])
sympy/polys/domains/domain.py:93: in convert
    return self.convert_from(element, base)
sympy/polys/domains/domain.py:83: in convert_from
    result = _convert(element, base)
sympy/polys/domains/pythonrationalfield.py:61: in from_RealField
    p, q = K0.to_rational(a)
sympy/polys/domains/realfield.py:98: in to_rational
    return self._context.to_rational(element, limit)
sympy/polys/domains/mpelements.py:120: in to_rational
    p, q = to_rational(s._mpf_)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

s = (0, 7522769485253779, 268851419954916787, 53)

    def to_rational(s):
        """Convert a raw mpf to a rational number. Return integers (p, q)
        such that s = p/q exactly."""
        sign, man, exp, bc = s
        if sign:
            man = -man
        if bc == -1:
            raise ValueError("cannot convert %s to a rational number" % man)
        if exp >= 0:
           return man * (1<<exp), 1
           MemoryError

../../../virtualenv/python3.4.2/lib/python3.4/site-packages/mpmath/libmp/libmpf.py:479: MemoryError

Wrong rank for matrix with det = 0

Perhaps, this is an instance of #287.

In [26]: m = Matrix([[-E**(I*k)*I/(4*k) + 1/2 + E**(-I*k)*I/(4*k),  E**(I*k)*I/(4*k) + 1/2 - E**(-I*k)*I/(4*k),    E**(I*k)/4 + 1/2 + E**(-I*k)/4,   -E**(I*k)/4 - 1/2 - E**(-I*k)/4],[ E**(I*k)*I/(4*k) + 1/2 - E**(-I*k)*I/(4*k), -E**(I*k)*I/(4*k) + 1/2 + E**(-I*k)*I/(4*k),   -E**(I*k)/4 - 1/2 - E**(-I*k)/4,    E**(I*k)/4 + 1/2 + E**(-I*k)/4],[             E**(I*k)/4 + 1/2 + E**(-I*k)/4,             -E**(I*k)/4 - 1/2 - E**(-I*k)/4,  E**(I*k)*I*k/4 - E**(-I*k)*I*k/4, -E**(I*k)*I*k/4 + E**(-I*k)*I*k/4],[            -E**(I*k)/4 - 1/2 - E**(-I*k)/4,              E**(I*k)/4 + 1/2 + E**(-I*k)/4, -E**(I*k)*I*k/4 + E**(-I*k)*I*k/4,  E**(I*k)*I*k/4 - E**(-I*k)*I*k/4]]); m
Out[26]: 
⎡   ⅈ⋅k          -ⅈ⋅k      ⅈ⋅k          -ⅈ⋅k         ⅈ⋅k        -ⅈ⋅k          ⅈ⋅k        -ⅈ⋅k  ⎤
⎢  ℯ   ⋅ⅈ   1   ℯ    ⋅ⅈ   ℯ   ⋅ⅈ   1   ℯ    ⋅ⅈ      ℯ      1   ℯ             ℯ      1   ℯ      ⎥
⎢- ────── + ─ + ───────   ────── + ─ - ───────      ──── + ─ + ─────       - ──── - ─ - ─────  ⎥
⎢   4⋅k     2     4⋅k      4⋅k     2     4⋅k         4     2     4            4     2     4    ⎥
⎢                                                                                              ⎥
⎢  ⅈ⋅k          -ⅈ⋅k        ⅈ⋅k          -ⅈ⋅k         ⅈ⋅k        -ⅈ⋅k        ⅈ⋅k        -ⅈ⋅k   ⎥
⎢ ℯ   ⋅ⅈ   1   ℯ    ⋅ⅈ     ℯ   ⋅ⅈ   1   ℯ    ⋅ⅈ      ℯ      1   ℯ           ℯ      1   ℯ       ⎥
⎢ ────── + ─ - ───────   - ────── + ─ + ───────    - ──── - ─ - ─────       ──── + ─ + ─────   ⎥
⎢  4⋅k     2     4⋅k        4⋅k     2     4⋅k         4     2     4          4     2     4     ⎥
⎢                                                                                              ⎥
⎢    ⅈ⋅k        -ⅈ⋅k          ⅈ⋅k        -ⅈ⋅k      ⅈ⋅k        -ⅈ⋅k          ⅈ⋅k        -ⅈ⋅k    ⎥
⎢   ℯ      1   ℯ             ℯ      1   ℯ         ℯ   ⋅ⅈ⋅k   ℯ    ⋅ⅈ⋅k     ℯ   ⋅ⅈ⋅k   ℯ    ⋅ⅈ⋅k⎥
⎢   ──── + ─ + ─────       - ──── - ─ - ─────     ──────── - ─────────   - ──────── + ─────────⎥
⎢    4     2     4            4     2     4          4           4            4           4    ⎥
⎢                                                                                              ⎥
⎢     ⅈ⋅k        -ⅈ⋅k        ⅈ⋅k        -ⅈ⋅k        ⅈ⋅k        -ⅈ⋅k        ⅈ⋅k        -ⅈ⋅k     ⎥
⎢    ℯ      1   ℯ           ℯ      1   ℯ           ℯ   ⋅ⅈ⋅k   ℯ    ⋅ⅈ⋅k   ℯ   ⋅ⅈ⋅k   ℯ    ⋅ⅈ⋅k ⎥
⎢  - ──── - ─ - ─────       ──── + ─ + ─────     - ──────── + ─────────   ──────── - ───────── ⎥
⎣     4     2     4          4     2     4            4           4          4           4     ⎦

In [27]: m.det()
Out[27]: 0

In [28]: m.rank()
Out[28]: 4

In [29]: m.cols
Out[29]: 4

In [30]: m.rows
Out[30]: 4

See SymPy issues:
sympy/sympy#9480
sympy/sympy#11238

and PR's:
sympy/sympy#10280
sympy/sympy#10650

dsolve: keep Integral's unevaluated by default

This should finally stop bugs like sympy/sympy#11131 and reduce time for ode tests. E.g.:

In [1]: %time dsolve(diff(f(x), x, x) - 8*cos(x) + sec(x)**2)
CPU times: user 49min 10s, sys: 58.5 s, total: 50min 8s
Wall time: 1h 18min
Out[1]: 
                                                           ⌠              
              ⎛                sin(x)⎞   ⌠                 ⎮       2      
f(x) = C₁ + x⋅⎜C₂ + 8⋅sin(x) - ──────⎟ - ⎮ 8⋅x⋅cos(x) dx - ⎮ -x⋅sec (x) dx
              ⎝                cos(x)⎠   ⌡                 ⌡              

Perhaps, default hint should be made an alias of all_Integral or something like that.

polys todo

(meta issue)

Wrong hyperexpand(hyper((2, 3, 5, 9, 1), (1, 4, 6, 10), 1))

This is underlying issue for #236

In [1]: hyper((2, 3, 5, 9, 1), (1, 4, 6, 10), 1)
Out[1]: 
 ┌─  ⎛2, 3, 5, 9, 1 │  ⎞
 ├─  ⎜              │ 1⎟
5╵ 4 ⎝ 1, 4, 6, 10  │  ⎠

In [2]: hyperexpand(_)
Out[2]: 
12⋅(-526 + 484⋅expₚₒₗₐᵣ(0))   21⋅(-73 + 85⋅expₚₒₗₐᵣ(0)) 
─────────────────────────── + ──────────────────────────
 5⋅(-672 + 672⋅expₚₒₗₐᵣ(0))   5⋅(-336 + 336⋅expₚₒₗₐᵣ(0))

In [3]: _1.n()
Out[3]: 15.4285714285714

In [4]: _2.n()
Out[4]: 0.e+135

Does work if we use limit on hyperexpand output:

In [1]: hyperexpand(hyper((2, 3, 5, 9, 1), (1, 4, 6, 10), z))
Out[1]: 
    6        5        4       3                                                        
45⋅z    105⋅z    117⋅z    45⋅z        2   45⋅z                                         
───── - ────── - ────── + ───── + 15⋅z  + ──── + 45   ⎛    6        4     ⎞            
  7       4        2        4              2          ⎝45⋅z  - 135⋅z  + 90⎠⋅log(-z + 1)
─────────────────────────────────────────────────── + ─────────────────────────────────
                          8                                             9              
                         z                                           2⋅z               

In [2]: _.limit(z, 1)
Out[2]: 108/7

Output from solve() should be consistent

Right now, sometimes it is a list of tuple's:

In [2]: solve([x*y - 7, x + y - 6], [x, y])
Out[2]: 
⎡⎛    ___        ___    ⎞  ⎛  ___          ___    ⎞⎤
⎣⎝- ╲╱ 2  + 3, ╲╱ 2  + 3⎠, ⎝╲╱ 2  + 3, - ╲╱ 2  + 3⎠⎦

and sometimes a list of dict's:

In [3]: solve([x - y + 2, x + y - 3], [x, y])
Out[3]: {x: 1/2, y: 5/2}

The later can be enforced with dict keyword argument:

In [4]: solve([x*y - 7, x + y - 6], [x, y], dict=True)
Out[4]: 
⎡⎧       ___           ___    ⎫  ⎧     ___             ___    ⎫⎤
⎢⎨x: - ╲╱ 2  + 3, y: ╲╱ 2  + 3⎬, ⎨x: ╲╱ 2  + 3, y: - ╲╱ 2  + 3⎬⎥
⎣⎩                            ⎭  ⎩                            ⎭⎦

Probably, we should pick "dict"-output as a default. See also old discussion.

repr printing oddness

As it stated by the python docs about returned value of __repr__(), "If at all possible, this should look like a valid Python expression that could be used to recreate an object with the same value (given an appropriate environment)."

It seems, that SymPy's printing system violates this maxima. "More accurate rule" - is that repr() output for SymPy's objects is something that can be "a suitable input for sympify()". See this. An example is Rational's printing:

In [3]: repr(Rational(1, 2))
Out[3]: '1/2'

I believe, we should prefer python's conventions.

Use py.test for testing

  • use py.test for regular tests, #38
  • use py.test for doctests, #48
  • test sphinx files with py.test, #90
  • test examples, #96
  • use py.test in the setup.py, see this 041678e #99
  • remove bundled py.test copy (sympy/utilities/runtests.py and so on), #96
  • remove sympy/utilities/pytest.py?

(meta issue)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.