Thanks, Mateusz. I ran into another expression and tried
extension=True but it failed with an error. q should factor neatly
into (x+sqrt(2)/2)*(x-sqrt(3)/3). Whatever is the solution to get that
to factor should probably be applied in the solving routine so
solutions come back in a simple form. Here I am trying to solve the
expanded form of the above for x:

>>> var('x');q=S('6**(1/2)/6 - x*2**(1/2)/2 + x*3**(1/2)/3 - x**2');solve(q,x)
x
[-2**(1/2)*(3 + (15 + 6*6**(1/2))**(1/2) - 6**(1/2))/12, -2**(1/2)*(3
- 6**(1/2) - (15 + 6*6**(1/2))**(1/2))/12]
>>> [nsimplify(w) for w in _]
[-2**(1/2)/2, 3**(1/2)/3]

Now here is the failed extension=True factoring of the same:
>>> q
6**(1/2)/6 - x*2**(1/2)/2 + x*3**(1/2)/3 - x**2
>>> factor(q, extension=True)
Traceback (most recent call last):
  File "<interactive input>", line 1, in <module>
  File "C:\Documents and Settings\chris\sympy\sympy\polys
\polytools.py", line 2245, in factor
    coeff, factors = _factor(f)
  File "C:\Documents and Settings\chris\sympy\sympy\polys
\polytools.py", line 2237, in _factor
    (coeff, factors), result = F.factor_list(**args), S.One
  File "C:\Documents and Settings\chris\sympy\sympy\polys
\polytools.py", line 1387, in factor_list
    result = f.rep.factor_list(**args)
  File "C:\Documents and Settings\chris\sympy\sympy\polys
\polyclasses.py", line 1497, in factor_list
    result = dmp_factor_list(f.rep, f.lev, f.dom, **args)
  File "C:\Documents and Settings\chris\sympy\sympy\polys
\factortools.py", line 1139, in dmp_factor_list
    return dup_factor_list(f, K0, **args)
  File "C:\Documents and Settings\chris\sympy\sympy\polys
\factortools.py", line 1061, in dup_factor_list
    coeff, factors = dup_ext_factor(f, K0)
  File "C:\Documents and Settings\chris\sympy\sympy\polys
\factortools.py", line 1016, in dup_ext_factor
    h, _, g = dup_inner_gcd(h, g, K)
  File "C:\Documents and Settings\chris\sympy\sympy\polys
\densetools.py", line 1253, in dup_inner_gcd
    return dup_ff_prs_gcd(f, g, K)
  File "C:\Documents and Settings\chris\sympy\sympy\polys
\densetools.py", line 887, in dup_ff_prs_gcd
    h = dup_monic(h, K)
  File "C:\Documents and Settings\chris\sympy\sympy\polys
\densetools.py", line 1408, in dup_monic
    return dup_quo_ground(f, lc, K)
  File "C:\Documents and Settings\chris\sympy\sympy\polys
\densearith.py", line 144, in dup_quo_ground
    return [ K.quo(cf, c) for cf in f ]
  File "C:\Documents and Settings\chris\sympy\sympy\polys
\algebratools.py", line 508, in quo
    return a / b
  File "C:\Documents and Settings\chris\sympy\sympy\polys
\polyclasses.py", line 2230, in __div__
    return f.exquo(g)
  File "C:\Documents and Settings\chris\sympy\sympy\polys
\polyclasses.py", line 2153, in quo
    return per(dup_rem(dup_mul(F, dup_invert(G, mod, dom), dom), mod,
dom))
  File "C:\Documents and Settings\chris\sympy\sympy\polys
\densetools.py", line 367, in dup_invert
    raise NotInvertible("zero divisor")
NotInvertible: zero divisor

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to sy...@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.

Reply via email to