title: SymPy, simplification / substitution using known patterns or sub-expressions
body: <p>I have the following expression:</p>
  
  <pre><code>from sympy import pi, sin, cos, var, simplify
  var('j,u,v,w,vt,wt,a2,t,phi')
  
  u0 = v*a2*sin(pi*j/2 + pi*j*t*phi**(-1)/2) + pi*vt*a2*cos(pi*j/2 + pi*j*t*phi**(-1)/2)*j*phi**(-1)/2 + pi*w*a2*cos(pi*j/2 + pi*j*t*phi**(-1)/2)*j*phi**(-1)
  </code></pre>
  
  <p>Which can be simplified:</p>
  
  <pre><code>print simplify(u0)
  #a2*(pi*j*vt*cos(pi*j*(phi + t)/(2*phi)) + 2*pi*j*w*cos(pi*j*(phi + t)/(2*phi)) + 2*phi*v*sin(pi*j*(phi + t)/(2*phi)))/(2*phi)
  </code></pre>
  
  <p>Given the sub-expressions:</p>
  
  <pre><code>bj = pi*j*(phi + t)/(2*phi)
  cj = j*pi/(2*phi)
  </code></pre>
  
  <p>Currently I substitute manually <code>bj</code> and <code>cj</code> in the simplified <code>u0</code> expression to get:</p>
  
  <pre><code>u0 = a2*(v*sin(bj) + cj*vt*cos(bj) + 2*cj*w*cos(bj))
  </code></pre>
  
  <p>Is it possible to use SymPy to achieve that, avoiding the manual substitution?</p>