Thanks Aaron!

It may be, that the new polynomials can't handle floating point
numbers (for some algorithmic reasons), in which case imho we should
provide the user with the following options:

a) convert floating point numbers to Rational and run solve(), and at
the end, convert all roots to floating point numbers again, it has the
advantage of finding all the roots (I mean as long as they can be
found analytically)
b) use some numerical algorithms

Maybe for polynomial equations, there are numerical algorithms that
return (find) all roots automatically? nsolve() currently needs an
initial guess.

Ondrej

On Sat, Mar 20, 2010 at 2:39 PM, Aaron S. Meurer <asmeu...@gmail.com> wrote:
> I bisected it down to this commit:
>
> 2686805263d86639420ae56414666d38f0efaa8c is the first bad commit
> commit 2686805263d86639420ae56414666d38f0efaa8c
> Author: Mateusz Paprocki <matt...@gmail.com>
> Date:   Sun Mar 14 21:18:04 2010 +0100
>
>    Fixed and improved solve(x**4 + x**3 + x**2 + x + 1)
>
> :040000 040000 76beac15724bf74859d6a156f965434016a29680 
> e7e966361cfd8b1fefaa96fbc2430ab8f234d6ad M      sympy
>
> Hope that helps.
>
> Aaron Meurer
> On Mar 20, 2010, at 3:25 PM, Ondrej Certik wrote:
>
>> 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 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.
>>
>
> --
> 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.
>
>

-- 
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