Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Multiply symbolic function by number or expression

I want to define a symbolic function in terms of other symbolic functions, like so:

function('psi psi_1 psi_2')
psi = 1/sqrt(2) * (psi_1 + psi_2 * i)

When running the code, I get the error:

TypeError: unsupported operand type(s) for *: 'NewSymbolicFunction' and 'sage.rings.number_field.number_field_element_quadratic.NumberFieldElement_gaussian'

The same error appears when I replace i with a real number.

Is there any fundamental mistake I'm making? If so, what should I do instead? If not, is there a workaround?

The reason I am defining a function like this is because I need to find the derivative of the psi function in terms of derivatives of the latter two functions.