On May 25, 2011, at 3:01 AM, Mateusz Paprocki wrote: > Hi, > > On 25 May 2011 10:43, Aaron S. Meurer <asmeu...@gmail.com> wrote: > What happens if you make it use an algebraic domain, i.e., set extension=True? > > That's a good suggestion. Usually polys (domains or whatever else) in not the > problem (unless there is some bug and there are still quite a few there), but > the way the module is used. We can't expect that polys will work in all > contexts without fine tuning (see sympy/polys/polyoptions.py). polys are > optimized for symbolic manipulation (simplification etc.) so in other > contexts you may need to override the defaults. Look for example into > gosper_normal() in sympy/concrete/gosper.py (the first line). Two options > (field and extension) had to be specified to adjust polys behavior to make it > useful in the context of Gosper's algorithm. Similar thing happens in > solve(). Unfortunately solve() was updated to use polys properly. > > btw. > > Did you notice this odd printing (- -): > > In [37]: F = [(x - 5)**2 + (y - 5)**2 - 4, -(-x + 5)*(-x - 2*2**(1/S(2)) + 5) > - (-y + 5)*(-y + 5)] > > In [38]: F > Out[38]: > ⎡ 2 2 ⎛ ⎽⎽⎽ ⎞ 2⎤ > ⎣(x - 5) + (y - 5) - 4, - -(x - 5)⋅⎝-x - 2⋅╲╱ 2 + 5⎠ - (-y + 5) ⎦
I bisected this, and it shouldn't be any surprise what caused it: commit b8d6252ea115032f7da8c46aca60af0b6a75fd36 Author: Ronan Lamy <ronan.l...@normalesup.org> Date: Thu Jan 13 23:43:00 2011 +0000 Set keep_sign = True I created http://code.google.com/p/sympy/issues/detail?id=2425 for this. Aaron Meurer > > > Aaron Meurer > > On May 24, 2011, at 10:14 PM, smichr wrote: > > > One of the problems I am running into with polys is this: > > > >>>> p1,p2=[(x - 5)**2 + (y - 5)**2 - 4, -(-x + 5)*(-x - 2*2**(1/ > > S(2)) + 5) - (-y > > + 5)*(-y + 5)] > >>>> solve([p1,p2]) > > Traceback (most recent call last): > > File "<stdin>", line 1, in <module> > > File "sympy\solvers\solvers.py", line 236, in solve > > solution = _solve(f, *symbols, **flags) > > File "sympy\solvers\solvers.py", line 607, in _solve > > soln = solve_poly_system(polys) > > File "sympy\solvers\polysys.py", line 45, in solve_poly_system > > return solve_generic(polys, opt) > > File "sympy\solvers\polysys.py", line 179, in solve_generic > > result = solve_reduced_system(polys, opt.gens, entry=True) > > File "sympy\solvers\polysys.py", line 149, in > > solve_reduced_system > > raise NotImplementedError("only zero-dimensional systems > > supported (finite n > > umber of solutions)") > > NotImplementedError: only zero-dimensional systems supported > > (finite number of s > > olutions) > > > > The two expressions end up getting different domains: > > [Poly(x**2 - 10*x + y**2 - 10*y + 46, x, y, domain='ZZ'), > > Poly(-x**2 + (-2*2**(1 /2) + 10)*x - y**2 + 10*y - 50 + > > 10*2**(1/2), x, y, domain='EX')] > > > > If I get rid of the sqrt(2) then the domains are both ZZ and it works. > >>>> p2 > > -(-x + 5)*(-x - 2*2**(1/2) + 5) - (-y + 5)**2 > >>>> _.subs(sqrt(2),2) > > (-x + 1)*(x - 5) - (-y + 5)**2 > >>>> solve([p1,_]) > > [(4, -3**(1/2) + 5), (4, 3**(1/2) + 5)] > > > > What's the best way to make solve flexible so it will handle this? > > > > -- > > You received this message because you are subscribed to the Google Groups > > "sympy" group. > > To post to this group, send email to sympy@googlegroups.com. > > To unsubscribe from this group, send email to > > sympy+unsubscr...@googlegroups.com. > > For more options, visit this group at > > http://groups.google.com/group/sympy?hl=en. > > > > -- > You received this message because you are subscribed to the Google Groups > "sympy" group. > To post to this group, send email to sympy@googlegroups.com. > To unsubscribe from this group, send email to > sympy+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/sympy?hl=en. > > > Mateusz > > -- > You received this message because you are subscribed to the Google Groups > "sympy" group. > To post to this group, send email to sympy@googlegroups.com. > To unsubscribe from this group, send email to > sympy+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/sympy?hl=en. -- You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to sympy@googlegroups.com. To unsubscribe from this group, send email to sympy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sympy?hl=en.