title: sympy .subs() built-in function doesn't work
body: <p>I'm trying to implement the multivariate chain rule using python, when I try to substitute one of the elements using the built-in sympy function expr.subs() I won't get an answer.</p>
  <p>The exercise goes as follows:</p>
  <p>Compute df/dx of the following function using the chain rule:</p>
  <p>a = x^2</p>
  <p>b = exp(a)</p>
  <p>c = a + b</p>
  <p>d = log(c)</p>
  <p>e = sin(c)</p>
  <p>f = d + e
  ⁡
  And this is the code:</p>
  <pre><code>a, b, c, d, e, f = sym.symbols('a b c d e f')
  
  f = d + e
  
  dfd = sym.diff(f, d)
  dfe = sym.diff(f, e)
  df = sym.Matrix([[dfd, dfe]])
  
  d = sym.log(c)
  e = sym.sin(c)
  ddc = sym.diff(d)
  dde = sym.diff(e)
  dd = sym.Matrix([[ddc],[dde]])
  
  dfdd = df@dd
  
  c = a + b
  dca = sym.diff(c, a)
  dcb = sym.diff(c, b)
  dc = sym. Matrix([[dca, dcb]])
  
  dfdc = dfdd@dc
  
  a = x**2
  b = sym.exp(a)
  
  result = dfdc.subs(c, (a + b))
  result
  </code></pre>
  <p>The result the function .subs() doesn't substitute anything and I don't know why, I tried substituting it using other ways to write the function, like:</p>
  <pre><code>dfdc.subs({c : (a + b)})
  dfdc.subs(c, a + b)
  </code></pre>
  <p>And even tried to just substitute it for an integer to see it that would work and neither does it.</p>
  <p>What am I doing wrong?</p>