# Revision history [back]

No need to include psi in your initial function declaration, as you then define psi in the next line.

Not sure how to explain the error you get, but here is something that works:

sage: psi1, psi2 = function('psi_1 psi_2')
sage: psi(t) = 1/sqrt(2) * (psi_1(t) + psi_2(t) * i)


This defines psi as a function:

sage: psi
t |--> 1/2*sqrt(2)*(psi_1(t) + I*psi_2(t))


and you can differentiate it:

sage: diff(psi(t), t)
1/2*sqrt(2)*(diff(psi_1(t), t) + I*diff(psi_2(t), t))


No need to include psi in your initial function declaration, as you then define psi in the next line.

Not sure how to explain the error you get, but here is something that works:

sage: psi1, psi2 = function('psi_1 function('psi_1, psi_2')
sage: psi(t) = 1/sqrt(2) * (psi_1(t) + psi_2(t) * i)


This That defines psi as a function:function. Observe the result:

sage: psi
t |--> 1/2*sqrt(2)*(psi_1(t) + I*psi_2(t))


and you That function can differentiate it:be differentiated:

sage: diff(psi)
t |--> 1/2*sqrt(2)*(diff(psi_1(t), t) + I*diff(psi_2(t), t))

sage: diff(psi(t), t)
1/2*sqrt(2)*(diff(psi_1(t), t) + I*diff(psi_2(t), t))