Issue 1139: Description and Differentiation of vector, tensor, and multivector fields. http://code.google.com/p/sympy/issues/detail?id=1139
Comment #28 by [EMAIL PROTECTED]: Code: from sympy import * class IF(Function): def __new__(cls,Fstr,vars): obj = Function.__new__(cls,Fstr,*tuple(vars)) return obj x = sympy.symbols('x1','x2') f = IF('f',x) g = IF('g',x) print 'f =',f print 'g =',g h = f+g print 'h =',h Output: f = IF(f, x1, x2) g = IF(g, x1, x2) h = Traceback (most recent call last): File "test.py", line 16, in <module> print 'h =',h File "/usr/lib/python2.5/site-packages/sympy/core/basic.py", line 681, in __str__ return StrPrinter.doprint(self) File "/usr/lib/python2.5/site-packages/sympy/printing/printer.py", line 48, in doprint return self._str(self._print(expr)) File "/usr/lib/python2.5/site-packages/sympy/printing/printer.py", line 96, in _print res = getattr(self, '_print_'+cls.__name__)(expr, *args) File "/usr/lib/python2.5/site-packages/sympy/printing/str.py", line 44, in _print_Add args.sort(Basic._compare_pretty) File "/usr/lib/python2.5/site-packages/sympy/core/basic.py", line 490, in _compare_pretty r_a = a.match(p1 * p2**p3) File "/usr/lib/python2.5/site-packages/sympy/core/basic.py", line 1263, in match return pattern.matches(self, {}) File "/usr/lib/python2.5/site-packages/sympy/core/mul.py", line 429, in matches return AssocOp._matches_commutative(pattern, expr, repl_dict, evaluate) File "/usr/lib/python2.5/site-packages/sympy/core/operations.py", line 135, in _matches_commutative d2 = pattern.matches(expr, d1, evaluate=True) File "/usr/lib/python2.5/site-packages/sympy/core/mul.py", line 429, in matches return AssocOp._matches_commutative(pattern, expr, repl_dict, evaluate) File "/usr/lib/python2.5/site-packages/sympy/core/operations.py", line 95, in _matches_commutative pat = pat.subs(old, new) File "/usr/lib/python2.5/site-packages/sympy/core/basic.py", line 920, in subs return self._subs_old_new(old, new) File "/usr/lib/python2.5/site-packages/sympy/core/cache.py", line 85, in wrapper func_cache_it_cache[k] = r = func(*args, **kw_args) File "/usr/lib/python2.5/site-packages/sympy/core/basic.py", line 929, in _subs_old_new return self._eval_subs(old, new) File "/usr/lib/python2.5/site-packages/sympy/core/mul.py", line 630, in _eval_subs return self.__class__(*[s.subs(old, new) for s in self.args]) File "/usr/lib/python2.5/site-packages/sympy/core/basic.py", line 920, in subs return self._subs_old_new(old, new) File "/usr/lib/python2.5/site-packages/sympy/core/cache.py", line 85, in wrapper func_cache_it_cache[k] = r = func(*args, **kw_args) File "/usr/lib/python2.5/site-packages/sympy/core/basic.py", line 929, in _subs_old_new return self._eval_subs(old, new) File "/usr/lib/python2.5/site-packages/sympy/core/power.py", line 203, in _eval_subs return self.base.subs(old, new) ** self.exp.subs(old, new) File "/usr/lib/python2.5/site-packages/sympy/core/basic.py", line 920, in subs return self._subs_old_new(old, new) File "/usr/lib/python2.5/site-packages/sympy/core/cache.py", line 85, in wrapper func_cache_it_cache[k] = r = func(*args, **kw_args) File "/usr/lib/python2.5/site-packages/sympy/core/basic.py", line 929, in _subs_old_new return self._eval_subs(old, new) File "/usr/lib/python2.5/site-packages/sympy/core/function.py", line 196, in _eval_subs return Basic._seq_subs(self, old, new) File "/usr/lib/python2.5/site-packages/sympy/core/basic.py", line 1012, in _seq_subs return self.__class__(*[s.subs(old, new) for s in args]) TypeError: __new__() takes exactly 3 arguments (4 given) Is there a problem here? -- 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-issues@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sympy-issues?hl=en -~----------~----~----~----~------~----~------~--~---