Nathan,

On Mon, Oct 7, 2013 at 10:52 PM, Nathan Woods <[email protected]> wrote:
> The sympy function (the output of printing the expression) is:
> "t*x*y + x**2 + y**2 + Piecewise((0, x < 0.5), (1, x >= 0.5)) + cos(t) - 1"
>
> The error message is:
>
> TypeError: unsupported operand type(s) for |=: 'set' and 'Piecewise'
>
>
> The whole error output is:
>
> Traceback (most recent call last):
>   File "integration.py", line 201, in <module>
>     print IntegrableFunction(integrands[0],**test).integrate()
>   File "integration.py", line 52, in __init__
>     sympy_function,self.sympy_variables,args=self.args)
>   File "integration.py", line 167, in __init__
>     argument_sequence=self.sympy_variables,to_files=True)
>   File
> "/Users/woodscn/SCIPYTEST/lib/python2.7/site-packages/sympy/utilities/codegen.py",
> line 958, in codegen
>     return code_gen.write(routines, prefix, to_files, header, empty)
>   File
> "/Users/woodscn/SCIPYTEST/lib/python2.7/site-packages/sympy/utilities/codegen.py",
> line 445, in write
>     dump_fn(self, routines, f, prefix, header, empty)
>   File
> "/Users/woodscn/SCIPYTEST/lib/python2.7/site-packages/sympy/utilities/codegen.py",
> line 615, in dump_c
>     self.dump_code(routines, f, prefix, header, empty)
>   File
> "/Users/woodscn/SCIPYTEST/lib/python2.7/site-packages/sympy/utilities/codegen.py",
> line 489, in dump_code
>     code_lines.extend(self._call_printer(routine))
>   File
> "/Users/woodscn/SCIPYTEST/lib/python2.7/site-packages/sympy/utilities/codegen.py",
> line 593, in _call_printer
>     constants, not_c, c_expr = ccode(result.expr, assign_to=assign_to,
> human=False)
>   File
> "/Users/woodscn/SCIPYTEST/lib/python2.7/site-packages/sympy/printing/ccode.py",
> line 262, in ccode
>     return CCodePrinter(settings).doprint(expr, assign_to)
>   File
> "/Users/woodscn/SCIPYTEST/lib/python2.7/site-packages/sympy/printing/ccode.py",
> line 87, in doprint
>     code0 = self._doprint_a_piece(expr, assign_to)
>   File
> "/Users/woodscn/SCIPYTEST/lib/python2.7/site-packages/sympy/printing/codeprinter.py",
> line 30, in _doprint_a_piece
>     d = get_contraction_structure(expr)
>   File
> "/Users/woodscn/SCIPYTEST/lib/python2.7/site-packages/sympy/tensor/index_methods.py",
> line 401, in get_contraction_structure
>     result[key] |= d[key]
> TypeError: unsupported operand type(s) for |=: 'set' and 'Piecewise'


I see, here is how to reproduce it: https://gist.github.com/certik/6880300

This is definitely a bug. Franz, any idea why it would call the tensor module?

Ondrej

-- 
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 http://groups.google.com/group/sympy.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to