title: Elegant way to create symbolic derivatives of a function up to N-th order
body: <p>How I create derivatives of level n from f(x) thus far:</p>
  
  <p><code>f = exp(-(x/2)),f1 = diff (f), f2 = diff (f1), f3 = diff(f2), f4 = diff(f3), f5 = diff(f4)</code></p>
  
  <p>This command is can to do the following:</p>
  
  <ul>
  <li>Create a variable for each derivative</li>
  <li>Use the previous derivative for the next derivative</li>
  </ul>
  
  <p>What this command can't do:</p>
  
  <ul>
  <li>Input an integer (n) to determine how many derivatives should be created</li>
  <li>automatically create a diff for the previous differentiation</li>
  </ul>
  
  <p>How do I add the functionality I need to make this easier for me?
  Is there a way to do this more elegantly?</p>
  
  <p>The Syntax for a script should be something equivalent to to this java snippet:</p>
  
  <pre><code>int n;
  String function;
  
  //User input function
  //User input diff level n
  System.out.print("f(x)= " + function);
  
  for(i = 1; i &lt; n; i++){
  function = diff(function);
  system.out.print("f"+ i + "(x): " + function);
  }
  </code></pre>
  
  <p>I tried this in matlab, but I have no idea what I'm doing:</p>
  
  <pre><code>syms x
  int n = 0;
  string f;
  
  n = str2double(input('Enter an integer: ','s'));
  if isnan(n) || fix(n) ~= n
    disp('Please enter an integer')
  end
  
  disp('f(x) = ', f);
  
  f = str2function(input('Enter a function(String): ','s'));
  if isnan(f) || fix(f) ~= f
    disp('Please enter a String')
  end
  
  while n &gt; 1
      n = n-1;
      f = diff(f);
      disp('f',n,'(x)=', f)
  end
  </code></pre>