Polynomial methods do not work well with floating point coefficients. The coefficients of a polynomial f can be made rational by
F = nsimplify(f, rational=True). Then the roots of F can be found by
roots(F, extension=I). (The flag tells that the coefficient domain is the rational field
Aah, Alright thanks for the clarification. I fed the coefficients to
numpy.roots to get the solutions!
I have a pretty complicated expression as an integrand, and I want to integrate it numerically although I have to wrap some of the inner parts in UnevaluatedExpr to avoid choking the expression manipulation routines.
What sort of transformations does autowrap apply? .doit() or simplify? Can I get it to evaluate a definite integral numerically or am I stuck with autowrap'ing the integrand and applying scipy.quad?
I just synced my local fork of sympy with the master branch. When I run
bin/test I get the following error:
MacBook-Pro:sympy meganly$ bin/test Traceback (most recent call last): File "bin/test", line 105, in <module> import sympy File "/Users/meganly/sympy/sympy/__init__.py", line 64, in <module> from .concrete import * File "/Users/meganly/sympy/sympy/concrete/__init__.py", line 2, in <module> from .summations import summation, Sum File "/Users/meganly/sympy/sympy/concrete/summations.py", line 3, in <module> from sympy.calculus.singularities import is_decreasing File "/Users/meganly/sympy/sympy/calculus/__init__.py", line 4, in <module> from .singularities import (singularities, is_increasing, File "/Users/meganly/sympy/sympy/calculus/singularities.py", line 21, in <module> from sympy.solvers.solveset import solveset File "/Users/meganly/sympy/sympy/solvers/__init__.py", line 11, in <module> from .solvers import solve, solve_linear_system, solve_linear_system_LU, \ File "/Users/meganly/sympy/sympy/solvers/solvers.py", line 542 SyntaxError: Non-ASCII character '\xe2' in file /Users/meganly/sympy/sympy/solvers/solvers.py on line 543, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
Any ideas what's wrong for me locally?
__new__in your class and have it not do that
obj = super(DecimalRational, self).__new__(p, q) if not isinstance(obj, DecimalRational): obj = Expr.__new__(cls) obj.p = p obj.q = q return obj
if x is S.Halfand
DecimalRational(0.5)then it won't match