hbar is a special constant; you refer to it as HBar(), not as hbar, and it needs to be imported first. This is how you can replace it in an expression:
from sympy import * from sympy.physics.qho_1d import psi_n from sympy.physics.quantum.constants import HBar n, x, m, omega = symbols("n x m omega") psi_n(n, x, m, omega).subs(HBar(), 1) An attempt to lambdify the complete function psi_n fails because of the factorial; apparently it's not supported by code generation. psi = lambdify([n, x, m, omega], psi_n(n, x, m, omega).subs(HBar(), 1)) # error But if the parameter n is fixed, you can lambdify the rest: psi = lambdify([x, m, omega], psi_n(0, x, m, omega).subs(HBar(), 1)) Now psi is callable like psi(1, 2, 3). > -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sympy+unsubscr...@googlegroups.com. To post to this group, send email to sympy@googlegroups.com. Visit this group at https://groups.google.com/group/sympy. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/3fa705fd-8d15-4562-8fcd-882a7a3cb8aa%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.