Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

how to define symbolic function on functions?

I recently started using Sage in earnest, and was trying to define a function on functions. But:

inner_product(f,g) = integral(f(x) * g(x), (x,0,1))
inner_product

returns:

(f, g) |--> 1/3

Not surprisingly, trying to use it, it behaves as described:

e1(x) = 1
inner_product(e1,e1)

returns:

1/3

And curiously:

inner_product(f,g) = integral(f(x) * 1, (x,0,1))
inner_product

returns:

(f, g) |--> 1/2

What's going on here?