Comment #4 on issue 1097 by Vinzent.Steinberg: Poly.integrate() crash, but
integrate(Poly) work
http://code.google.com/p/sympy/issues/detail?id=1097
For reference:
In [1]: p =Poly(x + x**2*y + y**3, x, y)
In [2]: Qy = p.integrate(y, 0, pi)
---------------------------------------------------------------------------
PolynomialError Traceback (most recent call last)
/home/one/src/sympy/<ipython console> in <module>()
/home/one/src/sympy/sympy/polys/polytools.pyc in integrate(f, *specs,
**args)
1134 gen, m = spec, 1
1135
-> 1136 rep = rep.integrate(int(m), f._gen_to_level(gen))
1137
1138 return f.per(rep)
/home/one/src/sympy/sympy/polys/polytools.pyc in _gen_to_level(f, gen)
1015 return list(f.gens).index(sympify(gen))
1016 except ValueError:
-> 1017 raise PolynomialError("a valid generator expected,
got %s" % gen)
1018
1019 def degree(f, gen=0):
PolynomialError: a valid generator expected, got pi
In [3]: Qy = integrate(p, (y, 0, pi))
In [4]: Qy
Out[4]: Poly(pi**2/2*x**2 + pi*x + pi**4/4, x, domain='EX')
In [5]: integrate(p,(x, 0, 1),(y,0,1))
---------------------------------------------------------------------------
GeneratorsNeeded Traceback (most recent call last)
/home/one/src/sympy/<ipython console> in <module>()
/home/one/src/sympy/sympy/utilities/decorator.pyc in
threaded_decorator(expr, *args,
**kwargs)
54 return Add(*[ func(f, *args, **kwargs) for f in
expr.args ])
55 else:
---> 56 return func(expr, *args, **kwargs)
57
58 threaded_decorator.__doc__ = func.__doc__
/home/one/src/sympy/sympy/integrals/integrals.pyc in integrate(*args,
**kwargs)
537
538 if isinstance(integral, Integral):
--> 539 return integral.doit(deep = False)
540 else:
541 return integral
/home/one/src/sympy/sympy/integrals/integrals.pyc in doit(self, **hints)
174
175 function = antideriv._eval_interval(x, a, b)
--> 176 function = Poly(function, *gens)
177 else:
178 function = antideriv._eval_interval(x, a, b)
/home/one/src/sympy/sympy/polys/polytools.pyc in __new__(cls, rep, *gens,
**args)
474 return result
475 else:
--> 476 raise GeneratorsNeeded("can't initialize
from %s
without generators" % rep)
477
478 obj = Basic.__new__(cls)
GeneratorsNeeded: can't initialize from 11/12 without generators
I prefer btw the old way of printing. (1/2*pi**2 instead of pi**2/2)
--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings
--
You received this message because you are subscribed to the Google Groups
"sympy-issues" group.
To post to this group, send email to sympy-iss...@googlegroups.com.
To unsubscribe from this group, send email to
sympy-issues+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/sympy-issues?hl=en.