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 sympy+un...@googlegroups.com.
To post to this group, send email to sy...@googlegroups.com.
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.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/b9d49702-b96b-4142-8d41-90d6a50ad9ca%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to sympy+unsubscribe@googlegroups.com.