title: why are matlab symbolic calculations so slow?
body: <p>I was testing with the symbolic toolbox of Matlab. And wonder why it is so slow even when just calculating with symbolic numbers. To test it I wrote this</p>
  
  <pre><code>syms x
  
  x = subs(x,1);
  a = 1;
  
  tic
  for i=1:10000
      z_sym = x + 1;
  end
  toc
  
  tic
  for i=1:10000
      z_num = a + 1;
  end
  toc
  </code></pre>
  
  <p>For the first loop it says <code>Elapsed time is 4.358483 seconds.</code> and for the second on <code>Elapsed time is 0.000029 seconds.</code>. I know using the subs function gives me x=1 but it’s still of the typ <code>sym</code> and I could convert it with a cast to speed things up. But that’s the point. </p>
  
  <p>Why it takes around 15000 times longer to calculate 1+1 symbolic than it takes numeric. What is slowing Matlab so hard?</p>