Filters:
Languages
Toughness
Just bugs labeled...
-
The ODE docstrings (i.e., the stuff at http://docs.sympy.org/dev/modules/solvers/ode.html) has a lot of math in it, but the math is all written in text. We should write it using LaTeX, and wrap it with backticks (like `x \neq 0`). That way, it will render nicely in Sphinx. For people who read the text version, I think the pretty printing in the doctests should be enough.
-
> @@ -542,7 +542,11 @@ def test_1st_homogeneous_coeff_ode_check3(): > # (False, x*(log(exp(-LambertW(C1*x))) + LambertW(C1*x))*exp(-LambertW(C1*x) + 1)) > eq3 = f(x) + (x*log(f(x)/x) - 2*x)*diff(f(x),x) > sol3 = Eq(f(x), x*exp(1 - LambertW(C1*x))) > - assert checkodesol(eq3, sol3, solve_for_func=False)[0] > + assert checkodesol(eq3, sol3, solve_for_func=True)[0] > + # and without an assumption about x and f(x), the implicit form doesn't resolve, either: > + # (False, (log(f(x)/x) + log(x/f(x)))*f(x)) So checkodesol() needs to be more aggressive, since dsolve() obtains these logarithms by calling logcombine(force=True). An expand with force=True should be used on expressions being tested or else (as shown above) terms which should go to zero, don't: >>> log(f(x)/x) + log(x/f(x)) log(f(x)/x) + log(x/f(x)) >>> _.expand(force=True) 0
-
In [161]: summation( binomial(n,k)**2, (k,0,oo)) Out[161]: Γ(2⋅n + 1) ────────── 2 Γ(n + 1) In [162]: combsimp(summation( binomial(n,k)**2, (k,0,oo))) Out[162]: 2⋅n + 1 2 ⋅Γ(n + 1/2) ─────────────────── ___ 2⋅╲╱ π ⋅Γ(n + 1) First off, I have n defined as an integer, so IMHO gamma should reduce to factorial in that case. Second, this is just binomial(2*n, n). Third, why doesn't this work: In [165]: summation( binomial(n,k)**2, (k,0,oo)).rewrite(factorial) Out[165]: Γ(2⋅n + 1) ────────── 2 Γ(n + 1)
-
arg() returns evaluated iff the result is numeric. arg().rewrite(atan2) should be implemented so you can get the result even if it isn't.
-
· link
>>> factor(Piecewise((x*(x+2),x<1))) Piecewise((x**2 + 2*x, x < 1)) If factor is not going to work with Piecewise, it should not modify the expression. Apparently what happens is that expand is used (successfully) but nothing more is done so the unexpanded version is returned.
-
· link
problem: roots = solve_poly_system([((x-5)**2/250000 + (y-5/10)**2/250000) - 1, x],x,y) is OK while: roots = solve_poly_system([((x-5.0)**2/250000 + (y-5.0/10)**2/250000) - 1, x],x,y) is KO! Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/sympy/solvers/polysys.py", line 41, in solve_poly_system return solve_biquadratic(f, g, opt) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/sympy/solvers/polysys.py", line 68, in solve_biquadratic G = groebner([f, g]) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/sympy/polys/polytools.py", line 5672, in groebner return GroebnerBasis(F, *gens, **args) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/sympy/polys/polytools.py", line 5709, in __new__ raise DomainError("can't compute a Groebner basis over %s" % opt.domain) it's quite weird for me... what is missing???? thank you
-
I found this from the expression from issue 2834: In [50]: [minpoly(i) for i in x.as_numer_denom()] --------------------------------------------------------------------------- PolynomialError Traceback (most recent call last) /Users/aaronmeurer/Documents/python/sympy/sympy/<ipython-input-50-ffbba6cffd4e> in <module>() ----> 1 [minpoly(i) for i in x.as_numer_denom()] /Users/aaronmeurer/Documents/python/sympy/sympy/sympy/polys/numberfields.pyc in minimal_polynomial(ex, x, **args) 130 else: 131 F = [x - bottom_up_scan(ex)] + mapping.values() --> 132 G = groebner(F, symbols.values() + [x], order='lex') 133 134 _, factors = factor_list(G[-1]) /Users/aaronmeurer/Documents/python/sympy/sympy/sympy/polys/polytools.pyc in groebner(F, *gens, **args) 5458 5459 """ -> 5460 return GroebnerBasis(F, *gens, **args) 5461 5462 def is_zero_dimensional(F, *gens, **args): /Users/aaronmeurer/Documents/python/sympy/sympy/sympy/polys/polytools.pyc in __new__(cls, F, *gens, **args) 5485 5486 try: -> 5487 polys, opt = parallel_poly_from_expr(F, *gens, **args) 5488 except PolificationFailed, exc: 5489 raise ComputationFailed('groebner', len(F), exc) /Users/aaronmeurer/Documents/python/sympy/sympy/sympy/polys/polytools.pyc in parallel_poly_from_expr(exprs, *gens, **args) 3670 """Construct polynomials from expressions. """ 3671 opt = options.build_options(gens, args) -> 3672 return _parallel_poly_from_expr(exprs, opt) 3673 3674 def _parallel_poly_from_expr(exprs, opt): /Users/aaronmeurer/Documents/python/sympy/sympy/sympy/polys/polytools.pyc in _parallel_poly_from_expr(exprs, opt) 3721 3722 try: -> 3723 reps, opt = _parallel_dict_from_expr(exprs, opt) 3724 except GeneratorsNeeded: 3725 raise PolificationFailed(opt, origs, exprs, True) /Users/aaronmeurer/Documents/python/sympy/sympy/sympy/polys/polyutils.pyc in _parallel_dict_from_expr(exprs, opt) 276 277 if opt.gens: --> 278 reps, gens = _parallel_dict_from_expr_if_gens(exprs, opt) 279 else: 280 reps, gens = _parallel_dict_from_expr_no_gens(exprs, opt) /Users/aaronmeurer/Documents/python/sympy/sympy/sympy/polys/polyutils.pyc in _parallel_dict_from_expr_if_gens(exprs, opt) 161 coeff.append(factor) 162 else: --> 163 raise PolynomialError("%s contains an element of the generators set" % factor) 164 165 monom = tuple(monom) PolynomialError: sqrt(_a4) contains an element of the generators set In [83]: print x (-240*sqrt(2)*sqrt(sqrt(5) + 5)*sqrt(8*sqrt(5) + 40) - 360*sqrt(2)*sqrt(-8*sqrt(5) + 40)*sqrt(-sqrt(5) + 5) - 120*sqrt(10)*sqrt(-8*sqrt(5) + 40)*sqrt(-sqrt(5) + 5) + 120*sqrt(2)*sqrt(-8*sqrt(5) + 40)*sqrt(sqrt(5) + 5) + 120*sqrt(2)*sqrt(-sqrt(5) + 5)*sqrt(8*sqrt(5) + 40) + 120*sqrt(10)*sqrt(-8*sqrt(5) + 40)*sqrt(sqrt(5) + 5) + 120*sqrt(10)*sqrt(-sqrt(5) + 5)*sqrt(8*sqrt(5) + 40))/(-36000 - 7200*sqrt(5) + (12*sqrt(10)*sqrt(sqrt(5) + 5) + 24*sqrt(10)*sqrt(-sqrt(5) + 5))**2) The error also occurs if you just call minpoly(x).
-
· link
I think it would be better if sympy.functions didn't have any secondquant-specific code. So, secondquant should subclass KroneckerDelta (maybe it's OK to give the subclass the same name?) and all the secondquant methods like is_above_fermi, _get_preferred_index, etc. should be moved there.
-
The following raises a key error: import sympy as sy x=sy.symbols('x') f=sy.Function('f') eq=sy.Eq(sy.Derivative(f(x),x,2)-2*sy.Derivative(f(x),x)+f(x),sy.sin(x)) sy.dsolve(eq) The equivalent sy.dsolve(sy.Derivative(f(x),x,2)-2*sy.Derivative(f(x),x)+f(x)-sy.sin(x)) does not. From the traceback it appears that when dsolve tries the method of undetermined coefficients, it ends up calling sympy.simplify.separatevars which returns an incorrect intermediate value when passed an Equation instead of an expression. I am using the latest version of sympy off of Github. The traceback is: --------------------------------------------------------------------------- KeyError Traceback (most recent call last) <ipython-input-1-dd906d09c7e7> in <module>() 3 f=sy.Function('f') 4 eq=sy.Eq(sy.Derivative(f(x),x,2)-2*sy.Derivative(f(x),x)+f(x),sy.sin(x)) ----> 5 sy.dsolve(eq) c:\Python27\lib\site-packages\sympy\solvers\ode.py in dsolve(eq, func, hint, simplify, **kwargs) 477 # The key 'hint' stores the hint needed to be solved for. 478 hint = hints['hint'] --> 479 return _helper_simplify(eq, hint, hints, simplify) 480 481 def _helper_simplify(eq, hint, match, simplify=True): c:\Python27\lib\site-packages\sympy\solvers\ode.py in _helper_simplify(eq, hint, match, simplify) 497 # attempt to solve for func, and apply any other hint specific 498 # simplifications --> 499 rv = odesimp(solvefunc(eq, func, order, match), func, order, hint) 500 return rv 501 else: c:\Python27\lib\site-packages\sympy\solvers\ode.py in ode_nth_linear_constant_coeff_undetermined_coefficients(eq, func, order, match) 3124 returns='both') 3125 match.update(gensol) -> 3126 return _solve_undetermined_coefficients(eq, func, order, match) 3127 3128 c:\Python27\lib\site-packages\sympy\solvers\ode.py in _solve_undetermined_coefficients(eq, func, order, match) 3209 for i in Add.make_args(eqs): 3210 s = separatevars(i, dict=True, symbols=[x]) -> 3211 coeffsdict[s[x]] += s['coeff'] 3212 3213 coeffvals = solve(coeffsdict.values(), coefflist) KeyError: 2*(_a0*sin(x) - _a1*cos(x)) == sin(x)
