title: How to redefine a function in Mathematica by appending to it?
body: <p>When doing calculations in Mathematica I often need to redefine a function by appending to it. For example if I define   </p>
  
  <pre><code>f[n_] := n^2 + n + 1
  </code></pre>
  
  <p>then after some time I'd like to add 2n^3 so from now on </p>
  
  <pre><code>f[n] = 2n^3 + n^2 + n + 1. 
  </code></pre>
  
  <p>Then I'd like to add Sin[n] and going further </p>
  
  <pre><code>f[n] = 2n^3 + n^2 + n + 1 + Sin[n]. 
  </code></pre>
  
  <p>And so on.</p>
  
  <p>It's easy to do with variables, for example x += 2. Is there something similar for functions?…</p>
  
  <p>Edited to add – yes, I was doing that to semi-manually find a function that fits data the best. I know there are functions to do that but I wanted to see if I can get there myself. I  did that but the way was not elegant so that prompted this question.</p>