Hi. Here's what I want to do. I have the semidiscrete free Schrödinger equation, I*psi(n, t).diff(t) + (psi(n + 1, t) + psi(n - 1, t) - 2*psi(n, t))/h**2 == 0. I want to substitute the particular solution psi(n, t) = z**n*exp(-I*omega(z)*t). I can't just use subs, because, for example, eq.subs(psi(n, t), z**n*exp(-I*omega(z)*t)) will only replace psi(n, t), but not psi(n + 1, t) or psi(n - 1, t). If I had first typed def psi(n, t): return z**n*exp(-I*omega(z)*t) and just entered the Schrödinger equation, it would work.
Is there a way to easily do this symbolically in SymPy that I'm missing? I think I might be able to do it with a Lambda, and obviously I can do it by manually creating a subs dict for each term, but it would be somewhat complicated. I think there should be some option to subs, or some similar function, the lets me just type eq.subs(psi(n, t), z**n*exp(-I*omega(z)*t) and replace psi(n, t) with z**n*exp(-I*omega(z)*t but also psi(n + 1, t) with z**(n + 1)*exp(-I*omega(z)*t and so on. Aaron Meurer -- You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sympy?hl=en.
