Hi Mateusz,
what is the way to use solve with floating point coefficients, e.g.
this used to work:
In [1]: solve(x**2+x+1, x)
Out[1]:
⎡ ⎽⎽⎽ ⎽⎽⎽⎤
⎢ ⅈ⋅╲╱ 3 ⅈ⋅╲╱ 3 ⎥
⎢-1/2 - ───────, -1/2 + ───────⎥
⎣ 2 2 ⎦
In [2]: solve(x**2+x+1.0, x)
Out[2]: [-1/2 - 0.866025403784439⋅ⅈ, -1/2 + 0.866025403784439⋅ⅈ]
But now it doesn't:
In [1]: solve(x**2+x+1, x)
Out[1]:
⎡ ⎽⎽⎽ ⎽⎽⎽⎤
⎢ ⅈ⋅╲╱ 3 ⅈ⋅╲╱ 3 ⎥
⎢-1/2 - ───────, -1/2 + ───────⎥
⎣ 2 2 ⎦
In [2]: solve(x**2+x+1.0, x)
---------------------------------------------------------------------------
DomainError Traceback (most recent call last)
/home/ondrej/repos/sympy/<ipython console> in <module>()
/home/ondrej/repos/sympy/sympy/solvers/solvers.pyc in solve(f,
*symbols, **flags)
237 if poly.degree > 2:
238 flags['simplified'] = flags.get('simplified', False)
--> 239 result = roots(poly, cubics=True, quartics=True).keys()
240
241 elif strategy == GS_RATIONAL:
/home/ondrej/repos/sympy/sympy/polys/polyroots.pyc in roots(f, *gens, **flags)
326 raise PolynomialError('multivariate polynomials
are not supported')
327
--> 328 f, x = f.to_field(), f.gen
329
330 def _update_dict(result, root, k):
/home/ondrej/repos/sympy/sympy/polys/polytools.pyc in to_field(f)
771 """Make the ground domain a field. """
772 try:
--> 773 result = f.rep.to_field()
774 except AttributeError: # pragma: no cover
775 raise OperationNotSupported(f, 'to_field')
/home/ondrej/repos/sympy/sympy/polys/polyclasses.pyc in to_field(f)
1151 def to_field(f):
1152 """Make the ground domain a field. """
-> 1153 return f.convert(f.dom.get_field())
1154
1155 def convert(f, dom):
/home/ondrej/repos/sympy/sympy/polys/algebratools.pyc in get_field(self)
1186 def get_field(self):
1187 """Returns a field associated with `self`. """
-> 1188 raise DomainError('there is no field associated with %s' % self)
1189
1190 def get_exact(self):
DomainError: there is no field associated with RR
We need to fix this.
Ondrej
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sympy?hl=en.