You are on the right track. If you do
G := \int{ g(x) }{x};
H := \int{ h(x) }{x};
iG = G[0];
iH = H[0];
P := \int{ @(iG) @(iH) }{x};
it works as expected. The key is to first assign the integrand to a separate expression (and give it a new python name, like the iG
above), and then pull that expression into the expression for P
. It would be nice if you could skip line 3 & 4 and write instead
G := \int{ g(x) }{x};
H := \int{ h(x) }{x};
P := \int{ @(G[0]) @(H[0]) }{x};
but the '@' operator only accepts simple python variable names at the moment, so this will not work.
If you are confused by this all, note that when you write
\int{G[0] H[0]}{x}
then G[0]
and H[0]
are viewed as maths, not python. If you want to pull an expression, which you have previously given a python name (like the 'G' and 'H' above) into a maths expression, you need to use the @(...)
operator.
Please ask again if it is still confusing. Cadabra makes a distinction between 'maths expressions' and 'python expressions', and that can be a bit daunting in the beginning.