Aaron Thanks, I see. My code worked fine in Mathematica (which I have adapted to python). In Mathematica it was also easier to insert the numerical values when I needed to get the numerical values of the integrals. However python is free and I have easy access to lots of cpus!. Rewriting the formulas explicitly with Symbols instead of IndexedBased gave me the correct solutions, if albeit with messy lookng code. Regards Ken
On Sunday, July 10, 2016 at 2:46:40 PM UTC-7, Aaron Meurer wrote: > > Here's an issue for the problem. > https://github.com/sympy/sympy/issues/7423. It doesn't look like anyone > has figured out the source of the problem yet. > > Aaron Meurer > > On Sunday, July 10, 2016, Kenneth Frankel <[email protected] <javascript:>> > wrote: > >> Aaron >> Thanks, that was our guess. I've been trying to follow the error in the >> python debugger but it's pretty tedious. >> I'll run it through gdb and post it to github unless I here from anyone >> else about a fix. >> Regards >> Ken Frnakel >> >> On Friday, July 8, 2016 at 4:10:16 PM UTC-7, Aaron Meurer wrote: >>> >>> This looks like a bug in SymPy. >>> >>> Aaron Meurer >>> >>> On Fri, Jul 8, 2016 at 6:46 PM, Kenneth Frankel <[email protected]> wrote: >>> >>>> I downloaded python and simply (etc) from anaconda, and installed >>>> anaconda2 and anaconda3. >>>> I upgraded to the latest simply (1.0) and have this problem >>>> >>>> When I run >>>> >>>> import sympy >>>> >>>> from sympy import * >>>> >>>> sympy.__version__ >>>> >>>> >>>> x=Symbol('x') >>>> >>>> y=Symbol('y') >>>> >>>> M=IndexedBase('M') >>>> >>>> >>>> integrate(cos(M[0] + x*y),x) >>>> >>>> integrate(cos(M[0] + x),x) >>>> >>>> integrate(cos(M[0] * x),x) >>>> >>>> >>>> They all work except integrate(cos(M[0] * x),x) throws an error (see >>>> output below). >>>> >>>> All I can find in the documentation is that there can be 'problems'. >>>> >>>> Any idea if I am missing something or is there a bug in simply? >>>> >>>> In the meantime my problem is so complex, I can only use variables 2 at >>>> a time, >>>> >>>> so I can hardcode a fix in my formulas. >>>> >>>> >>>> Thanks for any advice. >>>> >>>> Regards, >>>> >>>> Ken Frankel >>>> >>>> >>>> output: >>>> >>>> (same in python 3.5.1 and 2.7.11 >>>> >>>> >>>> python >>>> >>>> Python 2.7.11 |Anaconda 4.0.0 (32-bit)| (default, Dec 6 2015, >>>> 18:08:45) >>>> >>>> [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2 >>>> >>>> Type "help", "copyright", "credits" or "license" for more information. >>>> >>>> Anaconda is brought to you by Continuum Analytics. >>>> >>>> Please check out: http://continuum.io/thanks and https://anaconda.org >>>> >>>> >>> import sympy >>>> >>>> >>> from sympy import * >>>> >>>> >>> sympy.__version__ >>>> >>>> '1.0' >>>> >>>> >>> >>>> >>>> >>> x=Symbol('x') >>>> >>>> >>> y=Symbol('y') >>>> >>>> >>> M=IndexedBase('M') >>>> >>>> >>> >>>> >>>> >>> integrate(cos(M[0] + x*y),x) >>>> >>>> Piecewise((x*cos(M[0]), Eq(y, 0)), (sin(x*y + M[0])/y, True)) >>>> >>>> >>>> >>> integrate(cos(M[0] + x),x) >>>> >>>> sin(x + M[0]) >>>> >>>> >>>> >>> integrate(cos(M[0] * x),x) >>>> >>>> Traceback (most recent call last): >>>> >>>> File "<stdin>", line 1, in <module> >>>> >>>> File >>>> "/home/Users/frankel/anaconda2/lib/python2.7/site-packages/sympy/integrals/integrals.py", >>>> >>>> line 1280, in integrate >>>> >>>> risch=risch, manual=manual) >>>> >>>> File >>>> "/home/Users/frankel/anaconda2/lib/python2.7/site-packages/sympy/integrals/integrals.py", >>>> >>>> line 486, in doit >>>> >>>> conds=conds) >>>> >>>> File >>>> "/home/Users/frankel/anaconda2/lib/python2.7/site-packages/sympy/integrals/integrals.py", >>>> >>>> line 860, in _eval_integral >>>> >>>> h = trigintegrate(g, x, conds=conds) >>>> >>>> File >>>> "/home/Users/frankel/anaconda2/lib/python2.7/site-packages/sympy/integrals/trigonometry.py", >>>> >>>> line 100, in trigintegrate >>>> >>>> return Piecewise((zz, Eq(a, 0)), (fx / a, True)) >>>> >>>> File >>>> "/home/Users/frankel/anaconda2/lib/python2.7/site-packages/sympy/functions/elementary/piecewise.py", >>>> >>>> line 110, in __new__ >>>> >>>> r = cls.eval(*newargs) >>>> >>>> File >>>> "/home/Users/frankel/anaconda2/lib/python2.7/site-packages/sympy/functions/elementary/piecewise.py", >>>> >>>> line 146, in eval >>>> >>>> cond_eval = cls.__eval_cond(cond) >>>> >>>> File >>>> "/home/Users/frankel/anaconda2/lib/python2.7/site-packages/sympy/functions/elementary/piecewise.py", >>>> >>>> line 507, in __eval_cond >>>> >>>> if checksol(cond, {}, minimal=True): >>>> >>>> File >>>> "/home/Users/frankel/anaconda2/lib/python2.7/site-packages/sympy/solvers/solvers.py", >>>> >>>> line 227, in checksol >>>> >>>> if not val.is_constant(*list(sol.keys()), simplify=not minimal): >>>> >>>> File >>>> "/home/Users/frankel/anaconda2/lib/python2.7/site-packages/sympy/core/expr.py", >>>> >>>> line 535, in is_constant >>>> >>>> simultaneous=True) >>>> >>>> File >>>> "/home/Users/frankel/anaconda2/lib/python2.7/site-packages/sympy/core/basic.py", >>>> >>>> line 893, in subs >>>> >>>> rv = rv._subs(old, d*m, **kwargs) >>>> >>>> File >>>> "/home/Users/frankel/anaconda2/lib/python2.7/site-packages/sympy/core/basic.py", >>>> >>>> line 1016, in _subs >>>> >>>> rv = fallback(self, old, new) >>>> >>>> File >>>> "/home/Users/frankel/anaconda2/lib/python2.7/site-packages/sympy/core/basic.py", >>>> >>>> line 988, in fallback >>>> >>>> arg = arg._subs(old, new, **hints) >>>> >>>> File >>>> "/home/Users/frankel/anaconda2/lib/python2.7/site-packages/sympy/core/basic.py", >>>> >>>> line 1016, in _subs >>>> >>>> rv = fallback(self, old, new) >>>> >>>> File >>>> "/home/Users/frankel/anaconda2/lib/python2.7/site-packages/sympy/core/basic.py", >>>> >>>> line 993, in fallback >>>> >>>> rv = self.func(*args) >>>> >>>> File >>>> "/home/Users/frankel/anaconda2/lib/python2.7/site-packages/sympy/tensor/indexed.py", >>>> >>>> line 334, in __new__ >>>> >>>> raise TypeError("Base label should be a string or Symbol.") >>>> >>>> TypeError: Base label should be a string or Symbol. >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "sympy" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to [email protected]. >>>> To post to this group, send email to [email protected]. >>>> Visit this group at https://groups.google.com/group/sympy. >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/sympy/9fdd6809-e4da-4ff1-a3be-d206f02cb169%40googlegroups.com >>>> >>>> <https://groups.google.com/d/msgid/sympy/9fdd6809-e4da-4ff1-a3be-d206f02cb169%40googlegroups.com?utm_medium=email&utm_source=footer> >>>> . >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> >>> -- >> You received this message because you are subscribed to the Google Groups >> "sympy" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To post to this group, send email to [email protected]. >> Visit this group at https://groups.google.com/group/sympy. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/sympy/b9d49702-b96b-4142-8d41-90d6a50ad9ca%40googlegroups.com >> >> <https://groups.google.com/d/msgid/sympy/b9d49702-b96b-4142-8d41-90d6a50ad9ca%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/sympy. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/023994f0-290d-4bec-8a7d-e89c252f0b2d%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
