integration in several variables

1 view
Skip to first unread message

kent-and

unread,
Mar 21, 2008, 11:37:21 AM3/21/08
to SympyCore, kent...@simula.no

Hi, I am trying to integrate a function over the reference triangle,
as follows:

import sys
sys.path.append("/home/kent-and/local/src/sympycore")
from sympycore import *

x = Symbol('x')
y = Symbol('y')
z = Symbol('z')

f = x+y
g = integrate(f, (x, 0, 1-y))
h = integrate(g, (y, 0, 1))

However, I get the error message:
Traceback (most recent call last):
File "simple_sympy_core_test.py", line 11, in <module>
h = integrate(g, (y, 0, 1))
File "sympycore/calculus/integration.py", line 93, in integrate
File "sympycore/calculus/integration.py", line 79, in
integrate_definite
File "sympycore/calculus/integration.py", line 79, in <genexpr>
File "sympycore/calculus/integration.py", line 73, in
integrate_definite
File "sympycore/calculus/integration.py", line 14, in unknown
NotImplementedError: don't know how to integrate (1 - y)**2


Why is that ?

Kent

Pearu Peterson

unread,
Mar 21, 2008, 11:57:06 AM3/21/08
to SympyCore
Currently sympycore integration code assumes expanded expressions
as inputs. This needs to be improved in future, of course, but for
now you can use the following:

h = integrate(g.expand(), (y, 0, 1))

HTH,
Pearu
Reply all
Reply to author
Forward
0 new messages