I guess what you are missing is that subs
will replace arbitrary expressions, not just symbols
>>> print simplify(u0).subs({pi*j*(phi + t)/(2*phi): bj, j*pi/(2*phi): cj})
a2*(pi*j*vt*cos(bj) + 2*pi*j*w*cos(bj) + 2*phi*v*sin(bj))/(2*phi)
(I used simplify
because that is what results in the pi*j*(phi + t)/(2*phi)
instead of pi*j/2 + pi*j*t/(2*phi)
, but it's not otherwise required)
Read http://docs.sympy.org/0.7.3/tutorial/basic_operations.html#substitution for more information about substitution and replacement. If you want to do more advanced replacement, take a look at the replace
method.